]> granicus.if.org Git - python/commitdiff
Issue #14471: Fix a possible buffer overrun in the winreg module.
authorKristján Valur Jónsson <kristjan@ccpgames.com>
Mon, 2 Apr 2012 15:23:29 +0000 (15:23 +0000)
committerKristján Valur Jónsson <kristjan@ccpgames.com>
Mon, 2 Apr 2012 15:23:29 +0000 (15:23 +0000)
Misc/NEWS
PC/winreg.c

index 3d9b8225bd403f6bd04da8e4e87763a243a6a0d3..18a8d73e694e9932c966b97ce27cc205bd595bfc 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,8 @@ Core and Builtins
 - 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
 -------
 
index 1bc47b958b4367090b8bca1c5a1521fc781a4f6f..240ca69c3972723384dbaa0e213097058fce1efd 100644 (file)
@@ -1110,7 +1110,7 @@ PyEnumKey(PyObject *self, PyObject *args)
      * 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;