summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2012-08-22 12:24:14 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2012-08-22 12:24:14 (GMT)
commiteb61f8b3a726a8cd1ae3bc3794623e7fe4dd5703 (patch)
treebc039fa286bfb3a28b295f719cb12b1939e16986 /Modules/main.c
parentee253ebf6265741dd3f747965dfa753e68532353 (diff)
downloadcpython-eb61f8b3a726a8cd1ae3bc3794623e7fe4dd5703.zip
cpython-eb61f8b3a726a8cd1ae3bc3794623e7fe4dd5703.tar.gz
cpython-eb61f8b3a726a8cd1ae3bc3794623e7fe4dd5703.tar.bz2
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.
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 5b4a7e2..5d1d896 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -616,7 +616,7 @@ Py_Main(int argc, wchar_t **argv)
script. */
if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0') {
wchar_t* buffer;
- size_t len = strlen(p);
+ size_t len = strlen(p) + 1;
size_t r;
buffer = malloc(len * sizeof(wchar_t));