Commits

Anonymous committed e69b21f

backport of 1.196: socket.recv(-1) fixup.

  • Participants
  • Parent commits 1339b6d
  • Branches 2.1

Comments (0)

Files changed (1)

File Modules/socketmodule.c

 	PyObject *buf;
 	if (!PyArg_ParseTuple(args, "i|i:recv", &len, &flags))
 		return NULL;
+        if (len < 0) {
+		PyErr_SetString(PyExc_ValueError,
+				"negative buffersize in connect");
+		return NULL;
+	}
 	buf = PyString_FromStringAndSize((char *) 0, len);
 	if (buf == NULL)
 		return NULL;