summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 6b0d67a..a370b1b 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3244,6 +3244,11 @@ PySSL_RAND(int len, int pseudo)
const char *errstr;
PyObject *v;
+ if (len < 0) {
+ PyErr_SetString(PyExc_ValueError, "num must be positive");
+ return NULL;
+ }
+
bytes = PyBytes_FromStringAndSize(NULL, len);
if (bytes == NULL)
return NULL;