mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
(Merge 3.3) Issue #20025: ssl.RAND_bytes() and ssl.RAND_pseudo_bytes() now
raise a ValueError if num is negative (instead of raising a SystemError).
This commit is contained in:
commit
36e96b8716
2 changed files with 9 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue