diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-07-11 00:17:13 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-07-11 00:17:13 (GMT) |
commit | bed7f1a51245e9c9ca63eeea779f387bfd5a05af (patch) | |
tree | 2cc339e532bc32b21ba1ec507857135c9eda2df3 /Modules | |
parent | c95300aceb6833bd68898cf97127bc18910d5406 (diff) | |
download | cpython-bed7f1a51245e9c9ca63eeea779f387bfd5a05af.zip cpython-bed7f1a51245e9c9ca63eeea779f387bfd5a05af.tar.gz cpython-bed7f1a51245e9c9ca63eeea779f387bfd5a05af.tar.bz2 |
Issue #23804: Fix SSL zero-length recv() calls to not block and raise EOF
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ssl.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 3cc472e..2732416 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; + } } } |