| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent eb023a8 commit 41a9f49
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + Fix use-after-free in ``Py_SetPythonHome(NULL)``, | ||
| 2 | + ``Py_SetProgramName(NULL)`` and ``_Py_SetProgramFullPath(NULL)`` function | ||
| 3 | + calls. Issue reported by Benedikt Reinartz. Patch by Victor Stinner. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -261,6 +261,8 @@ Py_SetPythonHome(const wchar_t *home) | |||
| 261 | 261 | _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); | |
| 262 | 262 | ||
| 263 | 263 | PyMem_RawFree(_Py_path_config.home); | |
| 264 | + _Py_path_config.home = NULL; | ||
| 265 | + | ||
| 264 | 266 | if (has_value) { | |
| 265 | 267 | _Py_path_config.home = _PyMem_RawWcsdup(home); | |
| 266 | 268 | } | |
@@ -282,6 +284,8 @@ Py_SetProgramName(const wchar_t *program_name) | |||
| 282 | 284 | _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); | |
| 283 | 285 | ||
| 284 | 286 | PyMem_RawFree(_Py_path_config.program_name); | |
| 287 | + _Py_path_config.program_name = NULL; | ||
| 288 | + | ||
| 285 | 289 | if (has_value) { | |
| 286 | 290 | _Py_path_config.program_name = _PyMem_RawWcsdup(program_name); | |
| 287 | 291 | } | |
@@ -302,6 +306,8 @@ _Py_SetProgramFullPath(const wchar_t *program_full_path) | |||
| 302 | 306 | _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); | |
| 303 | 307 | ||
| 304 | 308 | PyMem_RawFree(_Py_path_config.program_full_path); | |
| 309 | + _Py_path_config.program_full_path = NULL; | ||
| 310 | + | ||
| 305 | 311 | if (has_value) { | |
| 306 | 312 | _Py_path_config.program_full_path = _PyMem_RawWcsdup(program_full_path); | |
| 307 | 313 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments