mach_inject
mach_inject copied to clipboard
One err check missing
Since the code is diligently checking every return code, it should also check it here:
before: // Allocate the code. vm_address_t remoteCode = (vm_address_t)NULL; if( !err ) err = vm_allocate( remoteTask, &remoteCode, imageSize, 1 ); err = vm_protect(remoteTask, remoteCode, imageSize, 0, VM_PROT_EXECUTE | VM_PROT_WRITE | VM_PROT_READ);
after: // Allocate the code. vm_address_t remoteCode = (vm_address_t)NULL; if( !err ) err = vm_allocate( remoteTask, &remoteCode, imageSize, 1 ); if( !err ) err = vm_protect(remoteTask, remoteCode, imageSize, 0, VM_PROT_EXECUTE | VM_PROT_WRITE | VM_PROT_READ);
otherwise remoteCode could be undefined.
Agreed. Put it in a Pull Request and I'll merge it right in :-)