Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2699b2

Browse files
committed
Add sizeof() instead of hardcoding variable length
1 parent 9a928e7 commit b2699b2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

PC/_winreg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,8 @@ PyEnumKey(PyObject *self, PyObject *args)
10331033
long rc;
10341034
PyObject *retStr;
10351035
char *retBuf;
1036-
DWORD len = 256; /* includes NULL terminator */
10371036
char tmpbuf[256]; /* max key name length is 255 */
1037+
DWORD len = sizeof(tmpbuf); /* includes NULL terminator */
10381038

10391039
if (!PyArg_ParseTuple(args, "Oi:EnumKey", &obKey, &index))
10401040
return NULL;

0 commit comments

Comments
 (0)