]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport of 1.196: socket.recv(-1) fixup.
authorAnthony Baxter <anthonybaxter@gmail.com>
Sun, 23 Dec 2001 01:44:49 +0000 (01:44 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Sun, 23 Dec 2001 01:44:49 +0000 (01:44 +0000)
Modules/socketmodule.c

index e1b69d469dfeb99acd3b3a2875c3ffbaf4eb71c2..733e5e7032b1f7d9f67245d5a9d460cd1ab93c72 100644 (file)
@@ -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;