summaryrefslogtreecommitdiff
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-03-27 05:35:19 +0000
committerMartin Panter <vadmium+py@gmail.com>2016-03-27 05:35:19 +0000
commitb8089b4dde2986da237ee471c8f3645ec8a5975f (patch)
treed4ef2246a3d2d20e9ba8a3a9792e43ecb0a444c6 /Modules/_ssl.c
parent6ce9f4b9a4e77f2b2ed54925f2c1d3ca66dabb8d (diff)
downloadcpython-git-b8089b4dde2986da237ee471c8f3645ec8a5975f.tar.gz
Issue #26644: Raise ValueError for negative SSLSocket.recv() and read()
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 8f34f955cf..23d4d5ceab 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -1695,6 +1695,10 @@ static PyObject *PySSL_SSLread(PySSLSocket *self, PyObject *args)
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;