Skip to content

Commit

Permalink
Remove unneeded check
Browse files Browse the repository at this point in the history
byteslen is always at least 0 thanks to the check above.
  • Loading branch information
AZero13 committed Jun 26, 2023
1 parent 461c9a3 commit 12d07d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CoreFoundation/RunLoop.subproj/CFMessagePort.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ static void __CFMessagePortReplyCallBack(CFMachPortRef port, void *msg, CFIndex
uintptr_t msgp_extent = (uintptr_t)((uint8_t *)msgp + msgp->header.msgh_size);
uintptr_t data_extent = (uintptr_t)((uint8_t *)&(MSGP_INFO(replymsg, bytes)) + byteslen);
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
if (0 <= byteslen && data_extent <= msgp_extent) {
if (data_extent <= msgp_extent) {
reply = CFDataCreate(kCFAllocatorSystemDefault, MSGP_INFO(replymsg, bytes), byteslen);
} else {
reply = CFRetain(kCFBooleanFalse); // means NULL data
Expand Down

0 comments on commit 12d07d3

Please sign in to comment.