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.
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.
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));