components/python/python26/patches/Python26-29-recvfrom_into.patch
author John Beck <John.Beck@Oracle.COM>
Sat, 17 Jan 2015 09:17:37 -0800
branchs11-update
changeset 3661 47545fb8aed4
parent 2959 436698adc770
permissions -rw-r--r--
18978320 Userland components should specify TPNOs in Makefiles instead of pkg manifests

# Fix adapted from upstream: http://bugs.python.org/issue20246

--- Python-2.6.8/Modules/socketmodule.c	2014-02-12 15:21:37.045342837 -0800
+++ Python-2.6.8/Modules/socketmodule.c	2014-02-12 15:23:04.666145417 -0800
@@ -2635,6 +2635,13 @@
         recvlen = buflen;
     }
 
+    /* Check if the buffer is large enough */
+    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 */