Skip to content

Commit 0307ca1

Browse files
committed
Remove unneeded check in CFMessagePort
byteslen is always at least 0 thanks to the check above.
1 parent 461c9a3 commit 0307ca1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CoreFoundation/RunLoop.subproj/CFMessagePort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ static void __CFMessagePortReplyCallBack(CFMachPortRef port, void *msg, CFIndex
827827
uintptr_t msgp_extent = (uintptr_t)((uint8_t *)msgp + msgp->header.msgh_size);
828828
uintptr_t data_extent = (uintptr_t)((uint8_t *)&(MSGP_INFO(replymsg, bytes)) + byteslen);
829829
if (byteslen < 0) byteslen = 0; // from here on, treat negative same as zero -- this is historical behavior: a NULL return from the callback on the other side results in empty data to the original requestor
830-
if (0 <= byteslen && data_extent <= msgp_extent) {
830+
if (data_extent <= msgp_extent) {
831831
reply = CFDataCreate(kCFAllocatorSystemDefault, MSGP_INFO(replymsg, bytes), byteslen);
832832
} else {
833833
reply = CFRetain(kCFBooleanFalse); // means NULL data

0 commit comments

Comments
 (0)