]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
win32_urandom(): Raise ValueError if the argument is negative.
authorTim Peters <tim.peters@gmail.com>
Mon, 30 Aug 2004 17:08:02 +0000 (17:08 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 30 Aug 2004 17:08:02 +0000 (17:08 +0000)
Modules/posixmodule.c

index af60f0c3568910e2d6b802adc29908ee1150c410..477a1355e6fb461a68e46d594e48955f498e2693 100644 (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;