[Python-checkins] python/dist/src/Modules posixmodule.c, 2.332, 2.333

mwh at users.sourceforge.net mwh at users.sourceforge.net
Mon Jan 31 18:02:07 CET 2005


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21253

Modified Files:
	posixmodule.c 
Log Message:
Fix

[ 1077106 ] Negative numbers to os.read() cause segfault

Sorry for sitting on this for so long!  Is there a chance it could
make 2.3.5?


Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.332
retrieving revision 2.333
diff -u -d -r2.332 -r2.333
--- posixmodule.c	16 Jan 2005 08:57:38 -0000	2.332
+++ posixmodule.c	31 Jan 2005 17:01:59 -0000	2.333
@@ -5349,6 +5349,10 @@
 	PyObject *buffer;
 	if (!PyArg_ParseTuple(args, "ii:read", &fd, &size))
 		return NULL;
+	if (size < 0) {
+		errno = EINVAL;
+		return posix_error();
+	}
 	buffer = PyString_FromStringAndSize((char *)NULL, size);
 	if (buffer == NULL)
 		return NULL;



More information about the Python-checkins mailing list