diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-15 16:09:24 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-15 16:09:24 (GMT) |
commit | 2f5bbc6a123dfb36ed1f89e9016ec356695bdd8a (patch) | |
tree | 25849ddd7133bafc5f4de5a163cd24cdc819c1b3 /Python/pythonrun.c | |
parent | 8bdc130121550fa99d7e76c84a06deda21000cd4 (diff) | |
download | cpython-2f5bbc6a123dfb36ed1f89e9016ec356695bdd8a.zip cpython-2f5bbc6a123dfb36ed1f89e9016ec356695bdd8a.tar.gz cpython-2f5bbc6a123dfb36ed1f89e9016ec356695bdd8a.tar.bz2 |
pythonrun.c: fix Py_GetPythonHome(), use Py_ARRAY_LENGTH() to get the size of
the env_home buffer, not PATH_MAX+1. env_home is declared using MAXPATHLEN+1,
and PATH_MAX is not declared on IRIX.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 832df53..e02dbe2 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -817,8 +817,9 @@ Py_GetPythonHome(void) if (home == NULL && !Py_IgnoreEnvironmentFlag) { char* chome = Py_GETENV("PYTHONHOME"); if (chome) { - size_t r = mbstowcs(env_home, chome, PATH_MAX+1); - if (r != (size_t)-1 && r <= PATH_MAX) + size_t size = Py_ARRAY_LENGTH(env_home); + size_t r = mbstowcs(env_home, chome, size); + if (r != (size_t)-1 && r < size) home = env_home; } |