Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4118)

Unified Diff: Modules/socketmodule.c

Issue 12837: Patch for issue #12810 removed a valid check on socket ancillary data
Patch Set: Created 1 year, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1745,8 +1745,11 @@
static const size_t cmsg_len_end = (offsetof(struct cmsghdr, cmsg_len) +
sizeof(cmsgh->cmsg_len));
- /* Note that POSIX allows msg_controllen to be of signed type. */
- if (cmsgh == NULL || msg->msg_control == NULL || msg->msg_controllen < 0)
+ /* Note that POSIX in recent versions allows msg_controllen to be a signed
+ type fitting in 2**31-1, but older versions it says it should be
+ unsigned and fit within 2**32-1. */
+ if (cmsgh == NULL || msg->msg_control == NULL ||
+ ((long long)msg->msg_controllen) < 0)
return 0;
if (space < cmsg_len_end)
space = cmsg_len_end;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7