python: add buffer length check in sock_recvfrom_into()

This commit is contained in:
cinap_lenrek 2014-02-25 18:51:03 +01:00
parent ec37e34f07
commit c4fec93ab9

View file

@ -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 */