diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2001-11-19 10:41:26 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2001-11-19 10:41:26 (GMT) |
commit | fba64e1ecaa62799ee62e5c9988d2496ed6125d0 (patch) | |
tree | cf7d6b37a8bcd50ad95eb08ae13afd9780c93894 /Modules/socketmodule.c | |
parent | 27ae3118645eb8dcaf9f597e3f7602c593a97a14 (diff) | |
download | cpython-fba64e1ecaa62799ee62e5c9988d2496ed6125d0.zip cpython-fba64e1ecaa62799ee62e5c9988d2496ed6125d0.tar.gz cpython-fba64e1ecaa62799ee62e5c9988d2496ed6125d0.tar.bz2 |
Test for negative buffer sizes. Fixes #482871.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 2a62f5d..17f7461 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1481,6 +1481,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; |