diff options
author | Steve Dower <steve.dower@python.org> | 2020-07-06 16:32:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 16:32:00 (GMT) |
commit | dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5 (patch) | |
tree | 4b1d3d5130de1db92de3240f4decc656ee7247ef /Python/pathconfig.c | |
parent | deb016224cc506503fb05e821a60158c83918ed4 (diff) | |
download | cpython-dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5.zip cpython-dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5.tar.gz cpython-dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5.tar.bz2 |
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297)
Also enables using debug build of `python3_d.dll`
Reference: CVE-2020-15523
Diffstat (limited to 'Python/pathconfig.c')
-rw-r--r-- | Python/pathconfig.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/Python/pathconfig.c b/Python/pathconfig.c index 5c38041..9a30221 100644 --- a/Python/pathconfig.c +++ b/Python/pathconfig.c @@ -17,9 +17,6 @@ extern "C" { _PyPathConfig _Py_path_config = _PyPathConfig_INIT; -#ifdef MS_WINDOWS -wchar_t *_Py_dll_path = NULL; -#endif static int @@ -107,10 +104,6 @@ _PyPathConfig_ClearGlobal(void) _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); pathconfig_clear(&_Py_path_config); -#ifdef MS_WINDOWS - PyMem_RawFree(_Py_dll_path); - _Py_dll_path = NULL; -#endif PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); } @@ -147,31 +140,6 @@ _PyWideStringList_Join(const PyWideStringList *list, wchar_t sep) } -#ifdef MS_WINDOWS -/* Initialize _Py_dll_path on Windows. Do nothing on other platforms. */ -static PyStatus -_PyPathConfig_InitDLLPath(void) -{ - if (_Py_dll_path != NULL) { - /* Already set: nothing to do */ - return _PyStatus_OK(); - } - - PyMemAllocatorEx old_alloc; - _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); - - _Py_dll_path = _Py_GetDLLPath(); - - PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); - - if (_Py_dll_path == NULL) { - return _PyStatus_NO_MEMORY(); - } - return _PyStatus_OK(); -} -#endif - - static PyStatus pathconfig_set_from_config(_PyPathConfig *pathconfig, const PyConfig *config) { @@ -222,13 +190,6 @@ done: PyStatus _PyConfig_WritePathConfig(const PyConfig *config) { -#ifdef MS_WINDOWS - PyStatus status = _PyPathConfig_InitDLLPath(); - if (_PyStatus_EXCEPTION(status)) { - return status; - } -#endif - return pathconfig_set_from_config(&_Py_path_config, config); } @@ -455,13 +416,6 @@ pathconfig_global_init(void) { PyStatus status; -#ifdef MS_WINDOWS - status = _PyPathConfig_InitDLLPath(); - if (_PyStatus_EXCEPTION(status)) { - Py_ExitStatusException(status); - } -#endif - if (_Py_path_config.module_search_path == NULL) { status = pathconfig_global_read(&_Py_path_config); if (_PyStatus_EXCEPTION(status)) { |