diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-03-27 05:35:19 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-03-27 05:35:19 (GMT) |
commit | 5503d4731e822e90eea387efa37934d2df41c784 (patch) | |
tree | de55bcb02b77072ad1e4c8c78029d177652f8485 /Modules | |
parent | 13f0c6166ff41c0971755dcb0ab7f8205f0b32a1 (diff) | |
download | cpython-5503d4731e822e90eea387efa37934d2df41c784.zip cpython-5503d4731e822e90eea387efa37934d2df41c784.tar.gz cpython-5503d4731e822e90eea387efa37934d2df41c784.tar.bz2 |
Issue #26644: Raise ValueError for negative SSLSocket.recv() and read()
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ssl.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 3377138..51b5399 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1895,6 +1895,11 @@ _ssl__SSLSocket_read_impl(PySSLSocket *self, int len, int group_right_1, _PyTime_t timeout, deadline = 0; int has_timeout; + if (!group_right_1 && len < 0) { + PyErr_SetString(PyExc_ValueError, "size should not be negative"); + return NULL; + } + if (sock != NULL) { if (((PyObject*)sock) == Py_None) { _setSSLError("Underlying socket connection gone", |