From: Georg Brandl Date: Sat, 18 Feb 2006 23:44:24 +0000 (+0000) Subject: Add sizeof() instead of hardcoding variable length X-Git-Tag: v2.5a0~606 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2699b242d46312be13e7093ecf59ff949a190f7;p=python Add sizeof() instead of hardcoding variable length --- diff --git a/PC/_winreg.c b/PC/_winreg.c index c97bbc6a07..d402758609 100644 --- a/PC/_winreg.c +++ b/PC/_winreg.c @@ -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;