X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/c1d3e52e58e86c49f9d04e06ae8e0ece4b98250c..972562bf68a236b4580b6074415cbf4e07b0a0c6:/Inject.cpp diff --git a/Inject.cpp b/Inject.cpp index 051fc0c..b5136f6 100644 --- a/Inject.cpp +++ b/Inject.cpp @@ -28,6 +28,8 @@ #include "Pooling.hpp" #if defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__)) +#include + #include #include @@ -53,7 +55,7 @@ Type_ *shift(Type_ *data, size_t size) { return reinterpret_cast(reinterpret_cast(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(&main))); auto slash(cynject.rfind('/')); _assert(slash != std::string::npos); @@ -65,7 +67,8 @@ void InjectLibrary(int pid, int argc, const char *argv[]) { 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);