History

python: add buffer length check in sock_recvfrom_into()

cinap_lenrek committed 12 years ago

Commit abf07091 parent 091ae6b1 file · +6 −0Browse files

Showing the changes to sys/src/cmd/python/Modules/socketmodule.c (1 of 1 file). Show all

Unified · Split

sys/src/cmd/python/Modules/socketmodule.c+6−0
@@ -2547,6 +2547,12 @@ sock_recvfrom_into(PySocketSockObject *s, PyObject *args, PyObject* kwds) · 2546 unmodified lines
2547 recvlen = buflen;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 readlen = sock_recvfrom_guts(s, buf, recvlen, flags, &addr);2556 readlen = sock_recvfrom_guts(s, buf, recvlen, flags, &addr);
2551 if (readlen < 0) {2557 if (readlen < 0) {
2552 /* Return an error */2558 /* Return an error */