From: Anthony Baxter Date: Sun, 23 Dec 2001 01:44:49 +0000 (+0000) Subject: backport of 1.196: socket.recv(-1) fixup. X-Git-Tag: v2.1.2c1~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e40ae1f762bbbb6f38a01dd27a3de9bbb7d8db95;p=thirdparty%2FPython%2Fcpython.git backport of 1.196: socket.recv(-1) fixup. --- diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index e1b69d469dfe..733e5e7032b1 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1324,6 +1324,11 @@ PySocketSock_recv(PySocketSockObject *s, PyObject *args) PyObject *buf; if (!PyArg_ParseTuple(args, "i|i:recv", &len, &flags)) return NULL; + if (len < 0) { + PyErr_SetString(PyExc_ValueError, + "negative buffersize in connect"); + return NULL; + } buf = PyString_FromStringAndSize((char *) 0, len); if (buf == NULL) return NULL;