mirror of
https://github.com/python/cpython.git
synced 2025-11-13 07:26:31 +00:00
Test for negative buffer sizes. Fixes #482871.
This commit is contained in:
parent
27ae311864
commit
fba64e1eca
1 changed files with 5 additions and 0 deletions
|
|
@ -1481,6 +1481,11 @@ PySocketSock_recv(PySocketSockObject *s, PyObject *args)
|
||||||
PyObject *buf;
|
PyObject *buf;
|
||||||
if (!PyArg_ParseTuple(args, "i|i:recv", &len, &flags))
|
if (!PyArg_ParseTuple(args, "i|i:recv", &len, &flags))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (len < 0) {
|
||||||
|
PyErr_SetString(PyExc_ValueError,
|
||||||
|
"negative buffersize in connect");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
buf = PyString_FromStringAndSize((char *) 0, len);
|
buf = PyString_FromStringAndSize((char *) 0, len);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue