From: Guido van Rossum Date: Sun, 12 Jan 1997 20:14:01 +0000 (+0000) Subject: Skip empty paths read from the registry. X-Git-Tag: v1.5a1~537 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d08735a54b8aa249482d028a6d998bd9a08ad957;p=python Skip empty paths read from the registry. --- diff --git a/PC/getpath_nt.c b/PC/getpath_nt.c index 30dd601f20..2de74f12c4 100644 --- a/PC/getpath_nt.c +++ b/PC/getpath_nt.c @@ -89,12 +89,14 @@ getpythonregpath(HKEY keyBase, BOOL bWin32s) if (rc) break; rc = RegQueryValue(newKey, keyBuf, dataBuf+off, &reqdSize); if (rc) break; - adjust = strlen(dataBuf+off); - dataSize -= adjust; - off += adjust; - dataBuf[off++] = ';'; - dataBuf[off] = '\0'; - dataSize--; + if (reqdSize>1) { // If Nothing, or only '\0' copied. + adjust = strlen(dataBuf+off); + dataSize -= adjust; + off += adjust; + dataBuf[off++] = ';'; + dataBuf[off] = '\0'; + dataSize--; + } } /* Additionally, win32s doesnt work as expected, so the specific strlen() is required for 3.1. */