summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-08-30 17:08:02 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-08-30 17:08:02 (GMT)
commit51eba6115dd0289a8497fe184c0e699343696cb3 (patch)
tree03fb84c68991dc7ff29b74d93d9b9812876de075 /Modules
parent4ad8217ae993bf942a475ea4abfade50cc60a9c7 (diff)
downloadcpython-51eba6115dd0289a8497fe184c0e699343696cb3.zip
cpython-51eba6115dd0289a8497fe184c0e699343696cb3.tar.gz
cpython-51eba6115dd0289a8497fe184c0e699343696cb3.tar.bz2
win32_urandom(): Raise ValueError if the argument is negative.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index af60f0c..477a135 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;