commit | b8089b4dde2986da237ee471c8f3645ec8a5975f | [log] [tgz] |
---|---|---|
author | Martin Panter <vadmium+py@gmail.com> | Sun Mar 27 05:35:19 2016 +0000 |
committer | Martin Panter <vadmium+py@gmail.com> | Sun Mar 27 05:35:19 2016 +0000 |
tree | d4ef2246a3d2d20e9ba8a3a9792e43ecb0a444c6 | |
parent | 6ce9f4b9a4e77f2b2ed54925f2c1d3ca66dabb8d [diff] [blame] |
Issue #26644: Raise ValueError for negative SSLSocket.recv() and read()
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 8f34f95..23d4d5c 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c
@@ -1695,6 +1695,10 @@ goto error; if ((buf.buf == NULL) && (buf.obj == NULL)) { + if (len < 0) { + PyErr_SetString(PyExc_ValueError, "size should not be negative"); + goto error; + } dest = PyBytes_FromStringAndSize(NULL, len); if (dest == NULL) goto error;