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

Skip to content

Commit 58ab084

Browse files
committed
PyWin_FindRegisteredModule(): Conversion of sprintf() to
PyOS_snprintf() for buffer overrun avoidance.
1 parent d586756 commit 58ab084

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

PC/import_nt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ FILE *PyWin_FindRegisteredModule(const char *moduleName,
4949
* also no heap fragmentation!
5050
*/
5151
moduleKey = alloca(bufSize);
52-
sprintf(moduleKey,
53-
"Software\\Python\\PythonCore\\%s\\Modules\\%s%s",
54-
PyWin_DLLVersionString, moduleName, debugString);
52+
PyOS_snprintf(moduleKey, bufSize,
53+
"Software\\Python\\PythonCore\\%s\\Modules\\%s%s",
54+
PyWin_DLLVersionString, moduleName, debugString);
5555

5656
modNameSize = pathLen;
5757
regStat = RegQueryValue(keyBase, moduleKey, pathBuf, &modNameSize);

0 commit comments

Comments
 (0)