]> granicus.if.org Git - python/commitdiff
Merged revisions 65174 via svnmerge from
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 21 Jul 2008 21:13:14 +0000 (21:13 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 21 Jul 2008 21:13:14 +0000 (21:13 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65174 | amaury.forgeotdarc | 2008-07-21 23:06:46 +0200 (lun., 21 juil. 2008) | 3 lines

  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.
........

Modules/posixmodule.c

index a6a19c10a48ada68a12b229115f4fdd7ede4ba1b..bc17b6b049be0527277029d30e72e9dbb90a65b4 100644 (file)
@@ -6690,6 +6690,7 @@ win32_urandom(PyObject *self, PyObject *args)
        result = PyBytes_FromStringAndSize(NULL, howMany);
        if (result != NULL) {
                /* Get random data */
+               memset(PyBytes_AS_STRING(result), 0, howMany); /* zero seed */
                if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*)
                                      PyBytes_AS_STRING(result))) {
                        Py_DECREF(result);