summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c6
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)