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

Skip to content

Commit 5021ebc

Browse files
committed
Properly terminate file name.
1 parent da99683 commit 5021ebc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Python/import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ get_sourcefile(const char *file)
997997
}
998998

999999
strncpy(py, file, len-1);
1000-
py[len] = '\0';
1000+
py[len-1] = '\0';
10011001
if (stat(py, &statbuf) == 0 &&
10021002
S_ISREG(statbuf.st_mode)) {
10031003
u = PyUnicode_DecodeFSDefault(py);

0 commit comments

Comments
 (0)