mach_inject icon indicating copy to clipboard operation
mach_inject copied to clipboard

One err check missing

Open mulle-nat opened this issue 10 years ago • 1 comments

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.

mulle-nat avatar Nov 03 '13 18:11 mulle-nat

Agreed. Put it in a Pull Request and I'll merge it right in :-)

rentzsch avatar Nov 03 '13 20:11 rentzsch