Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9bd9cd3

Browse files
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)
2 parents 6f69fb1 + eb61f8b commit 9bd9cd3

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ What's New in Python 3.3.0 Release Candidate 1?
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #15761: Fix crash when PYTHONEXECUTABLE is set on Mac OS X.
14+
1315
- Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
1416
Patch by Robin Schreiber.
1517

Modules/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ Py_Main(int argc, wchar_t **argv)
604604
script. */
605605
if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0') {
606606
wchar_t* buffer;
607-
size_t len = strlen(p);
607+
size_t len = strlen(p) + 1;
608608

609609
buffer = malloc(len * sizeof(wchar_t));
610610
if (buffer == NULL) {

0 commit comments

Comments
 (0)