Showing the changes to sys/src/cmd/python/Modules/socketmodule.c (1 of 1 file). Show all
Unified · Split
| @@ -2547,6 +2547,12 @@ sock_recvfrom_into(PySocketSockObject *s, PyObject *args, PyObject* kwds) · 2546 unmodified lines | ||
| 2547 | 2547 | recvlen = buflen; |
| 2548 | 2548 | } |
| 2549 | 2549 | |
| 2550 | + if (buflen < recvlen) { | |
| 2551 | + PyErr_SetString(PyExc_ValueError, | |
| 2552 | + "buffer too small for requested bytes"); | |
| 2553 | + return NULL; | |
| 2554 | + } | |
| 2555 | + | |
| 2550 | 2556 | readlen = sock_recvfrom_guts(s, buf, recvlen, flags, &addr); |
| 2551 | 2557 | if (readlen < 0) { |
| 2552 | 2558 | /* Return an error */ |