From: Tim Peters Date: Mon, 30 Aug 2004 17:08:02 +0000 (+0000) Subject: win32_urandom(): Raise ValueError if the argument is negative. X-Git-Tag: v2.4a3~50 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=51eba6115dd0289a8497fe184c0e699343696cb3;p=thirdparty%2FPython%2Fcpython.git win32_urandom(): Raise ValueError if the argument is negative. --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index af60f0c35689..477a1355e6fb 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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;