From: Amaury Forgeot d'Arc Date: Mon, 21 Jul 2008 21:06:46 +0000 (+0000) Subject: On Windows, silence a Purify warning and initialize the memory passed to CryptGenRandom. X-Git-Tag: v2.6b3~259 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74bd40d85cf70fa8b8b4d9280efbb721c8ef4796;p=python On Windows, silence a Purify warning and initialize the memory passed to CryptGenRandom. Since python doesn't provide any particular random data, it seems more reasonable anyway. --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6af6e513d5..f18e1546eb 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -8250,6 +8250,7 @@ win32_urandom(PyObject *self, PyObject *args) result = PyString_FromStringAndSize(NULL, howMany); if (result != NULL) { /* Get random data */ + memset(PyString_AS_STRING(result), 0, howMany); /* zero seed */ if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*) PyString_AS_STRING(result))) { Py_DECREF(result);