X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/47f55bc70a0eef068c8a27ca0618a11c512dbf20..c4481e4036f73f230903a9521612bbca5ff32359:/Mach/Inject.cpp?ds=inline diff --git a/Mach/Inject.cpp b/Mach/Inject.cpp index 6ca0378..d109cdd 100644 --- a/Mach/Inject.cpp +++ b/Mach/Inject.cpp @@ -1,21 +1,21 @@ /* Cycript - Optimizing JavaScript Compiler/Runtime - * Copyright (C) 2009-2013 Jay Freeman (saurik) + * Copyright (C) 2009-2014 Jay Freeman (saurik) */ -/* GNU General Public License, Version 3 {{{ */ +/* GNU Affero General Public License, Version 3 {{{ */ /* - * Cycript is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation, either version 3 of the License, - * or (at your option) any later version. - * - * Cycript is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Cycript. If not, see . + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . **/ /* }}} */ @@ -58,7 +58,7 @@ void InjectLibrary(pid_t pid) { library[flength] = '\0'; _assert(strcmp(library + flength - 6, ".dylib") == 0); #if !TARGET_OS_IPHONE - strcpy(library + flength - 6, "-any.dylib"); + strcpy(library + flength - 6, "-###.dylib"); #endif mach_port_t self(mach_task_self()), task; @@ -292,8 +292,11 @@ void InjectLibrary(pid_t pid) { mach_vm_size_t error(sizeof(baton->error)); _krncall(mach_vm_read_overwrite(task, data + offsetof(Baton, error), sizeof(baton->error), reinterpret_cast(&baton->error), &error)); _assert(error == sizeof(baton->error)); - if (baton->error[0] != '\0') + + if (baton->error[0] != '\0') { + baton->error[sizeof(baton->error) - 1] = '\0'; CYThrow("%s", baton->error); + } _krncall(mach_vm_deallocate(task, code, trampoline->size_)); _krncall(mach_vm_deallocate(task, stack, size));