diff options
author | Christian Heimes <christian@python.org> | 2017-09-14 09:15:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-14 09:15:07 (GMT) |
commit | 472cc9f366ef16cab72eed21bdc6a24f194fc03a (patch) | |
tree | 1ce9e1442e2c46b84690354a975d903040120682 /Modules | |
parent | 5dbb28ececdd0382d85b164aaf37bec1ae08036c (diff) | |
download | cpython-472cc9f366ef16cab72eed21bdc6a24f194fc03a.zip cpython-472cc9f366ef16cab72eed21bdc6a24f194fc03a.tar.gz cpython-472cc9f366ef16cab72eed21bdc6a24f194fc03a.tar.bz2 |
[3.6] _ssl_: Fix compiler warning (GH-3559) (#3569)
Cast Py_buffer.len (Py_ssize_t, signed) to size_t (unsigned) to
prevent the following warning:
Modules/_ssl.c:3089:21: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare].
(cherry picked from commit 5a61559fb0776a9a0f08294ec9003cea13940430)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ssl.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 4a656a1..a32fce4 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -3024,6 +3024,12 @@ _ssl__SSLContext__set_alpn_protocols_impl(PySSLContext *self, /*[clinic end generated code: output=87599a7f76651a9b input=9bba964595d519be]*/ { #ifdef HAVE_ALPN + if ((size_t)protos->len > UINT_MAX) { + PyErr_Format(PyExc_OverflowError, + "protocols longer than %d bytes", UINT_MAX); + return NULL; + } + PyMem_FREE(self->alpn_protocols); self->alpn_protocols = PyMem_Malloc(protos->len); if (!self->alpn_protocols) |