]> granicus.if.org Git - python/commitdiff
Fix for issue 15716: interpreter could crash when PYTHONEXECUTABLE was set on Mac...
authorRonald Oussoren <ronaldoussoren@mac.com>
Wed, 22 Aug 2012 12:40:35 +0000 (14:40 +0200)
committerRonald Oussoren <ronaldoussoren@mac.com>
Wed, 22 Aug 2012 12:40:35 +0000 (14:40 +0200)
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)

1  2 
Misc/NEWS
Modules/main.c

diff --cc Misc/NEWS
Simple merge
diff --cc Modules/main.c
index e86aa77b654abb32b73e911b450267694cd41313,5d1d8964bfd59d23c29f4cb225c738026522792d..a16ce65cd131a5da93c8abec92fc315d81670b05
@@@ -604,7 -616,8 +604,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));
          if (buffer == NULL) {