summaryrefslogtreecommitdiffstats
path: root/Python/pathconfig.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-07-06 17:12:16 (GMT)
committerGitHub <noreply@github.com>2020-07-06 17:12:16 (GMT)
commitaa7f7756149a10c64d01f583b71e91814db886ab (patch)
tree2423c988772967d5090089f00550749ecde9b02d /Python/pathconfig.c
parent6790f9badda47c7aa0fe4b0b5f090d6ca0c477d5 (diff)
downloadcpython-aa7f7756149a10c64d01f583b71e91814db886ab.zip
cpython-aa7f7756149a10c64d01f583b71e91814db886ab.tar.gz
cpython-aa7f7756149a10c64d01f583b71e91814db886ab.tar.bz2
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297) (GH-21352)
Also enables using debug build of `python3_d.dll` Reference: CVE-2020-15523 (cherry picked from commit dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Python/pathconfig.c')
-rw-r--r--Python/pathconfig.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/Python/pathconfig.c b/Python/pathconfig.c
index bf18097..60c1044 100644
--- a/Python/pathconfig.c
+++ b/Python/pathconfig.c
@@ -15,9 +15,6 @@ extern "C" {
_PyPathConfig _Py_path_config = _PyPathConfig_INIT;
-#ifdef MS_WINDOWS
-wchar_t *_Py_dll_path = NULL;
-#endif
static int
@@ -105,10 +102,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);
}
@@ -145,31 +138,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)
{
@@ -220,13 +188,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);
}
@@ -454,13 +415,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)) {