Kaydet (Commit) 9bd9cd3f authored tarafından Ronald Oussoren's avatar Ronald Oussoren

Fix for issue 15716: interpreter could crash when PYTHONEXECUTABLE was set on Mac OS X.

This is due to an off-by-one error: the allocated buffer didn't have room for a NUL
character at the end of the mbstowcs result.

(merge with 3.2)
...@@ -10,6 +10,8 @@ What's New in Python 3.3.0 Release Candidate 1? ...@@ -10,6 +10,8 @@ What's New in Python 3.3.0 Release Candidate 1?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #15761: Fix crash when PYTHONEXECUTABLE is set on Mac OS X.
- Issue #15726: Fix incorrect bounds checking in PyState_FindModule. - Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
Patch by Robin Schreiber. Patch by Robin Schreiber.
......
...@@ -604,7 +604,7 @@ Py_Main(int argc, wchar_t **argv) ...@@ -604,7 +604,7 @@ Py_Main(int argc, wchar_t **argv)
script. */ script. */
if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0') { if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0') {
wchar_t* buffer; wchar_t* buffer;
size_t len = strlen(p); size_t len = strlen(p) + 1;
buffer = malloc(len * sizeof(wchar_t)); buffer = malloc(len * sizeof(wchar_t));
if (buffer == NULL) { if (buffer == NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment