Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 21022:9f66aaddf8d4 legacy-trunk
Test for negative buffer sizes. Fixes #482871.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Mon, 19 Nov 2001 10:41:26 +0000 |
| parents | 90871fa43f4e |
| children | 597d10cf7938 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Mon Nov 19 05:28:29 2001 +0000 +++ b/Modules/socketmodule.c Mon Nov 19 10:41:26 2001 +0000 @@ -1481,6 +1481,11 @@ 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;
