mirror of
https://github.com/python/cpython.git
synced 2025-11-27 13:45:25 +00:00
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.
This commit is contained in:
parent
be44991baa
commit
74bd40d85c
1 changed files with 1 additions and 0 deletions
|
|
@ -8250,6 +8250,7 @@ win32_urandom(PyObject *self, PyObject *args)
|
||||||
result = PyString_FromStringAndSize(NULL, howMany);
|
result = PyString_FromStringAndSize(NULL, howMany);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
/* Get random data */
|
/* Get random data */
|
||||||
|
memset(PyString_AS_STRING(result), 0, howMany); /* zero seed */
|
||||||
if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*)
|
if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*)
|
||||||
PyString_AS_STRING(result))) {
|
PyString_AS_STRING(result))) {
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue