summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-07-11 01:32:09 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-07-11 01:32:09 (GMT)
commit7386268ffd5a87ec03f80773c4cd8bf9dc9953f6 (patch)
treeddee745e0fe47397df0316a14a22eb19c06c6a44 /Modules/_ssl.c
parent4bf9c51f9b37dd08a2c02f637b5854ca6c8b8247 (diff)
parentbed7f1a51245e9c9ca63eeea779f387bfd5a05af (diff)
downloadcpython-7386268ffd5a87ec03f80773c4cd8bf9dc9953f6.zip
cpython-7386268ffd5a87ec03f80773c4cd8bf9dc9953f6.tar.gz
cpython-7386268ffd5a87ec03f80773c4cd8bf9dc9953f6.tar.bz2
Issue #23804: Merge SSL recv() fix from 3.5
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 8c3bb71..0e979e0 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -1913,6 +1913,10 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1,
dest = PyBytes_FromStringAndSize(NULL, len);
if (dest == NULL)
goto error;
+ if (len == 0) {
+ Py_XDECREF(sock);
+ return dest;
+ }
mem = PyBytes_AS_STRING(dest);
}
else {
@@ -1924,6 +1928,10 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1,
"maximum length can't fit in a C 'int'");
goto error;
}
+ if (len == 0) {
+ count = 0;
+ goto done;
+ }
}
}