ref: abf0709b80460e1b0a18e4f5e2bc3bcd05597dda
parent: 091ae6b6c5b14a5f0440ced7462abacd01bb0702
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Feb 25 13:51:03 EST 2014
python: add buffer length check in sock_recvfrom_into()
--- a/sys/src/cmd/python/Modules/socketmodule.c
+++ b/sys/src/cmd/python/Modules/socketmodule.c
@@ -2547,6 +2547,12 @@
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 */
--
⑨