From 51eba6115dd0289a8497fe184c0e699343696cb3 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Mon, 30 Aug 2004 17:08:02 +0000 Subject: win32_urandom(): Raise ValueError if the argument is negative. --- Modules/posixmodule.c | 3 +++ 1 file changed, 3 insertions(+) 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; -- cgit v0.12