mirror of https://github.com/python/cpython.git
Add sizeof() instead of hardcoding variable length
This commit is contained in:
parent
9a928e787c
commit
b2699b242d
|
@ -1033,8 +1033,8 @@ PyEnumKey(PyObject *self, PyObject *args)
|
||||||
long rc;
|
long rc;
|
||||||
PyObject *retStr;
|
PyObject *retStr;
|
||||||
char *retBuf;
|
char *retBuf;
|
||||||
DWORD len = 256; /* includes NULL terminator */
|
|
||||||
char tmpbuf[256]; /* max key name length is 255 */
|
char tmpbuf[256]; /* max key name length is 255 */
|
||||||
|
DWORD len = sizeof(tmpbuf); /* includes NULL terminator */
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "Oi:EnumKey", &obKey, &index))
|
if (!PyArg_ParseTuple(args, "Oi:EnumKey", &obKey, &index))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue