[Python-checkins] cpython (merge 3.2 -> default): Fix for issue 15716: interpreter could crash when PYTHONEXECUTABLE was set on

ronald.oussoren python-checkins at python.org
Wed Aug 22 14:40:56 CEST 2012


http://hg.python.org/cpython/rev/ae51329f9893
changeset: 78704:ae51329f9893
parent: 78702:6ce6707743d9
parent: 78703:526c6262d91f
user: Ronald Oussoren <ronaldoussoren at mac.com>
date: Wed Aug 22 14:40:35 2012 +0200
summary:
 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)
files:
 Misc/NEWS | 2 ++
 Modules/main.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,8 @@
 Core and Builtins
 -----------------
 
+- Issue #15761: Fix crash when PYTHONEXECUTABLE is set on Mac OS X.
+
 - Issue #15726: Fix incorrect bounds checking in PyState_FindModule.
 Patch by Robin Schreiber.
 
diff --git a/Modules/main.c b/Modules/main.c
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -604,7 +604,7 @@
 script. */
 if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '0円') {
 wchar_t* buffer;
- size_t len = strlen(p);
+ size_t len = strlen(p) + 1;
 
 buffer = malloc(len * sizeof(wchar_t));
 if (buffer == NULL) {
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /