[Python-checkins] r65174 - python/trunk/Modules/posixmodule.c

amaury.forgeotdarc python-checkins at python.org
Mon Jul 21 23:06:46 CEST 2008


Author: amaury.forgeotdarc
Date: Mon Jul 21 23:06:46 2008
New Revision: 65174
Log:
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.
Modified:
 python/trunk/Modules/posixmodule.c
Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c	(original)
+++ python/trunk/Modules/posixmodule.c	Mon Jul 21 23:06:46 2008
@@ -8250,6 +8250,7 @@
 	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);


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /