From 46009118ae27917691c9cd3b5d41c47f716cbb86 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sat, 20 Jun 2020 12:04:48 -0700 Subject: [PATCH 1/2] Fix a ptr to deallocated stack in pathconfig. Reported by Coverity. (CID 1457554 RETURN_LOCAL) --- Python/pathconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/pathconfig.c b/Python/pathconfig.c index fe3ac3ee3d8121..5c38041d7667bd 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); From 0ac16e70289a757d0650bf57840ad14c2ae65c82 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 21 Jun 2020 19:53:38 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core and Builtins/2020-06-21-19-53-33.bpo-41056.IDu_EK.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-06-21-19-53-33.bpo-41056.IDu_EK.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-21-19-53-33.bpo-41056.IDu_EK.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-21-19-53-33.bpo-41056.IDu_EK.rst new file mode 100644 index 00000000000000..25f93c9da31051 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-06-21-19-53-33.bpo-41056.IDu_EK.rst @@ -0,0 +1 @@ +Fixes a reference to deallocated stack space during startup when constructing sys.path involving a relative symlink when code was supplied via -c. (discovered via Coverity) \ No newline at end of file