]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix conversion from Py_ssize_t to int.
authorRichard Oudkerk <shibturn@gmail.com>
Sat, 7 Sep 2013 16:40:45 +0000 (17:40 +0100)
committerRichard Oudkerk <shibturn@gmail.com>
Sat, 7 Sep 2013 16:40:45 +0000 (17:40 +0100)
Modules/_multiprocessing/multiprocessing.c

index 30cb5eb451139a7e537ea82744c0db88dc8db5bf..1aaf3605714eda3b9d1b6ad8b5e4013029d0b38c 100644 (file)
@@ -99,13 +99,15 @@ multiprocessing_send(PyObject *self, PyObject *args)
 {
     HANDLE handle;
     Py_buffer buf;
-    int ret;
+    int ret, length;
 
     if (!PyArg_ParseTuple(args, F_HANDLE "y*:send" , &handle, &buf))
         return NULL;
 
+    length = (int)Py_MIN(buf.len, INT_MAX);
+
     Py_BEGIN_ALLOW_THREADS
-    ret = send((SOCKET) handle, buf.buf, buf.len, 0);
+    ret = send((SOCKET) handle, buf.buf, length, 0);
     Py_END_ALLOW_THREADS
 
     PyBuffer_Release(&buf);