bad logic for throwCantUnpack("cmdsize") [simple]

https://github.com/upx/upx/issues/161
	modified:   p_mach.cpp
This commit is contained in:
John Reiser
2017-12-19 17:36:22 -08:00
parent 990988f920
commit aefb2fa3c3
+1 -1
View File
@@ -1563,7 +1563,7 @@ void PackMachBase<T>::unpack(OutputFile *fo)
memcpy(&msegcmd[j], ptr, umin(sizeof(Mach_segment_command),
((Mach_command const *)ptr)->cmdsize));
ptr += (unsigned) ((Mach_command const *)ptr)->cmdsize;
if (ptr_udiff(ptr, mhdr) > ph.u_len) {
if (ptr_udiff(ptr, (1+ mhdr)) > ph.u_len) {
throwCantUnpack("cmdsize");
}
}