[Python-checkins] cpython: Issue #12837: POSIX.1-2008 allows socklen_t to be a signed integer: re-enable
charles-francois.natali
python-checkins at python.org
Sun Aug 28 18:22:26 CEST 2011
http://hg.python.org/cpython/rev/3ed2d087e70d
changeset: 72117:3ed2d087e70d
user: Charles-François Natali <neologix at free.fr>
date: Sun Aug 28 18:23:43 2011 +0200
summary:
Issue #12837: POSIX.1-2008 allows socklen_t to be a signed integer: re-enable
the check against negative values, and add a note on this surprising test.
Patch by David Watson.
files:
Modules/socketmodule.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1745,7 +1745,8 @@
static const size_t cmsg_len_end = (offsetof(struct cmsghdr, cmsg_len) +
sizeof(cmsgh->cmsg_len));
- if (cmsgh == NULL || msg->msg_control == NULL)
+ /* Note that POSIX allows msg_controllen to be of signed type. */
+ if (cmsgh == NULL || msg->msg_control == NULL || msg->msg_controllen < 0)
return 0;
if (space < cmsg_len_end)
space = cmsg_len_end;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list