summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2005-01-31 17:01:59 (GMT)
committerMichael W. Hudson <mwh@python.net>2005-01-31 17:01:59 (GMT)
commit9867ced6c2ba0a47a3d6fa54fdcc0d3a7d31597b (patch)
tree414d00b2aa6ecf45cdbf294d844700045b787961 /Modules/posixmodule.c
parentacdef858a51f32d2b2c82f3d47025cb26c2a63ee (diff)
downloadcpython-9867ced6c2ba0a47a3d6fa54fdcc0d3a7d31597b.zip
cpython-9867ced6c2ba0a47a3d6fa54fdcc0d3a7d31597b.tar.gz
cpython-9867ced6c2ba0a47a3d6fa54fdcc0d3a7d31597b.tar.bz2
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?
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 7ecd864..2d3eaa3 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5349,6 +5349,10 @@ posix_read(PyObject *self, PyObject *args)
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;