/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2014 Jay Freeman (saurik)
+ * Copyright (C) 2009-2015 Jay Freeman (saurik)
*/
/* GNU Affero General Public License, Version 3 {{{ */
#include "Pooling.hpp"
#if defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__))
+#include <unistd.h>
+
#include <sys/fcntl.h>
#include <sys/mman.h>
return reinterpret_cast<Type_ *>(reinterpret_cast<uint8_t *>(data) + size);
}
-void InjectLibrary(int pid, int argc, const char *argv[]) {
+void InjectLibrary(int pid, int argc, const char *const argv[]) {
auto cynject(LibraryFor(reinterpret_cast<void *>(&main)));
auto slash(cynject.rfind('/'));
_assert(slash != std::string::npos);
off_t offset;
_assert(csops(pid, CS_OPS_PIDOFFSET, &offset, sizeof(offset)) != -1);
- char path[PATH_MAX];
+ // XXX: implement a safe version of this
+ char path[4096];
int writ(proc_pidpath(pid, path, sizeof(path)));
_assert(writ != 0);