components/python/python26/patches/Python26-29-recvfrom_into.patch
branchs11u1-sru
changeset 2963 48e96df31087
equal deleted inserted replaced
2958:d9b5e8394801 2963:48e96df31087
       
     1 # Fix adapted from upstream: http://bugs.python.org/issue20246
       
     2 
       
     3 --- Python-2.6.8/Modules/socketmodule.c	2014-02-12 15:21:37.045342837 -0800
       
     4 +++ Python-2.6.8/Modules/socketmodule.c	2014-02-12 15:23:04.666145417 -0800
       
     5 @@ -2635,6 +2635,13 @@
       
     6          recvlen = buflen;
       
     7      }
       
     8  
       
     9 +    /* Check if the buffer is large enough */
       
    10 +    if (buflen < recvlen) {
       
    11 +        PyErr_SetString(PyExc_ValueError,
       
    12 +                        "buffer too small for requested bytes");
       
    13 +        return NULL;
       
    14 +    }
       
    15 +
       
    16      readlen = sock_recvfrom_guts(s, buf, recvlen, flags, &addr);
       
    17      if (readlen < 0) {
       
    18          /* Return an error */