python: add buffer length check in sock_recvfrom_into()
This commit is contained in:
parent
ec37e34f07
commit
c4fec93ab9
1 changed files with 6 additions and 0 deletions
|
@ -2547,6 +2547,12 @@ sock_recvfrom_into(PySocketSockObject *s, PyObject *args, PyObject* kwds)
|
|||
recvlen = buflen;
|
||||
}
|
||||
|
||||
if (buflen < recvlen) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"buffer too small for requested bytes");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
readlen = sock_recvfrom_guts(s, buf, recvlen, flags, &addr);
|
||||
if (readlen < 0) {
|
||||
/* Return an error */
|
||||
|
|
Loading…
Reference in a new issue