mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Properly terminate file name.
This commit is contained in:
parent
da9968371e
commit
5021ebc892
1 changed files with 1 additions and 1 deletions
|
@ -997,7 +997,7 @@ get_sourcefile(const char *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(py, file, len-1);
|
strncpy(py, file, len-1);
|
||||||
py[len] = '\0';
|
py[len-1] = '\0';
|
||||||
if (stat(py, &statbuf) == 0 &&
|
if (stat(py, &statbuf) == 0 &&
|
||||||
S_ISREG(statbuf.st_mode)) {
|
S_ISREG(statbuf.st_mode)) {
|
||||||
u = PyUnicode_DecodeFSDefault(py);
|
u = PyUnicode_DecodeFSDefault(py);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue