From: Jay Freeman (saurik) Date: Tue, 11 Mar 2014 22:33:35 +0000 (-0700) Subject: Verify the injection error buffer is null-termined. X-Git-Tag: v0.9.502~25 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/cd2e82fbf803897fbbc28b2d654efda939d46fee Verify the injection error buffer is null-termined. --- diff --git a/Mach/Inject.cpp b/Mach/Inject.cpp index 6ca0378..7d80599 100644 --- a/Mach/Inject.cpp +++ b/Mach/Inject.cpp @@ -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));