diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-06-22 07:47:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 07:47:54 (GMT) |
commit | 9fe5decf5f38ae247f4f354dee27e4bfbe8bc5f8 (patch) | |
tree | ed5d2ef0ce43cd2f8ed131811fbbc3eda8bbd739 /Python | |
parent | 8ae5e8ec8147e6434454e66953c25848b848711a (diff) | |
download | cpython-9fe5decf5f38ae247f4f354dee27e4bfbe8bc5f8.zip cpython-9fe5decf5f38ae247f4f354dee27e4bfbe8bc5f8.tar.gz cpython-9fe5decf5f38ae247f4f354dee27e4bfbe8bc5f8.tar.bz2 |
bpo-41056: Fix reference to deallocated stack in pathconfig (Coverity) (GH-21013)
Reported by Coverity. (CID 1457554 RETURN_LOCAL)
path0 is assigned as a pointer to this right before it goes out of scope.
(cherry picked from commit 81328f30703bd7225e7e73aedb0994a7293ce190)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pathconfig.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/pathconfig.c b/Python/pathconfig.c index fe3ac3e..5c38041 100644 --- a/Python/pathconfig.c +++ b/Python/pathconfig.c @@ -686,6 +686,7 @@ _PyPathConfig_ComputeSysPath0(const PyWideStringList *argv, PyObject **path0_p) #ifdef HAVE_READLINK wchar_t link[MAXPATHLEN + 1]; int nr = 0; + wchar_t path0copy[2 * MAXPATHLEN + 1]; if (have_script_arg) { nr = _Py_wreadlink(path0, link, Py_ARRAY_LENGTH(link)); @@ -708,7 +709,6 @@ _PyPathConfig_ComputeSysPath0(const PyWideStringList *argv, PyObject **path0_p) } else { /* Must make a copy, path0copy has room for 2 * MAXPATHLEN */ - wchar_t path0copy[2 * MAXPATHLEN + 1]; wcsncpy(path0copy, path0, MAXPATHLEN); q = wcsrchr(path0copy, SEP); wcsncpy(q+1, link, MAXPATHLEN); |