Add sizeof() instead of hardcoding variable length
authorGeorg Brandl <georg@python.org>
Sat, 18 Feb 2006 23:44:24 +0000 (23:44 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 18 Feb 2006 23:44:24 +0000 (23:44 +0000)
PC/_winreg.c

index c97bbc6a07776776be409373b61a091dfb79dd33..d4027586093a56aac489fca64649d01917c1d0d3 100644 (file)
@@ -1033,8 +1033,8 @@ PyEnumKey(PyObject *self, PyObject *args)
        long rc;
        PyObject *retStr;
        char *retBuf;
-       DWORD len = 256;  /* includes NULL terminator */
        char tmpbuf[256]; /* max key name length is 255 */
+       DWORD len = sizeof(tmpbuf); /* includes NULL terminator */
 
        if (!PyArg_ParseTuple(args, "Oi:EnumKey", &obKey, &index))
                return NULL;