[Python-checkins] cpython (3.2): Issue #14471: Fix a possible buffer overrun in the winreg module.

kristjan.jonsson python-checkins at python.org
Mon Apr 2 17:41:33 CEST 2012


http://hg.python.org/cpython/rev/b3639f6aaa2b
changeset:   76070:b3639f6aaa2b
branch:      3.2
parent:      76068:60ad83716733
user:        Kristján Valur Jónsson <kristjan at ccpgames.com>
date:        Mon Apr 02 15:23:29 2012 +0000
summary:
  Issue #14471: Fix a possible buffer overrun in the winreg module.

files:
  Misc/NEWS   |  2 ++
  PC/winreg.c |  2 +-
  2 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,8 @@
 - Issue #13521: dict.setdefault() now does only one lookup for the given key,
   making it "atomic" for many purposes.  Patch by Filip Gruszczyński.
 
+- Issue #14471: Fix a possible buffer overrun in the winreg module.
+
 Library
 -------
 
diff --git a/PC/winreg.c b/PC/winreg.c
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -1110,7 +1110,7 @@
      * nul.  RegEnumKeyEx requires a 257 character buffer to
      * retrieve such a key name. */
     wchar_t tmpbuf[257];
-    DWORD len = sizeof(tmpbuf); /* includes NULL terminator */
+    DWORD len = sizeof(tmpbuf)/sizeof(wchar_t); /* includes NULL terminator */
 
     if (!PyArg_ParseTuple(args, "Oi:EnumKey", &obKey, &index))
         return NULL;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list