win32_urandom(): Raise ValueError if the argument is negative.

This commit is contained in:
Tim Peters 2004-08-30 17:08:02 +00:00
parent 4ad8217ae9
commit 51eba6115d

View file

@ -7246,6 +7246,9 @@ win32_urandom(PyObject *self, PyObject *args)
/* Read arguments */
if (! PyArg_ParseTuple(args, "i", &howMany))
return NULL;
if (howMany < 0)
return PyErr_Format(PyExc_ValueError,
"negative argument not allowed");
if (hCryptProv == 0) {
HINSTANCE hAdvAPI32 = NULL;