summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2013-11-17 09:17:18 +0100
committerGeorg Brandl <georg@python.org>2013-11-17 09:17:18 +0100
commitfc24508775333a3e67f6b638499a1b665add506c (patch)
treec798a9c46013204eff7c7cc021838c5495aee9cd /Python/pythonrun.c
parent52dd5649f40a4002c68b498a7b541d8a73ba658b (diff)
parent349e4b4530e0c3d2c1f1448642e6f35498225d08 (diff)
downloadcpython-fc24508775333a3e67f6b638499a1b665add506c.tar.gz
merge with 3.3.3 release clone
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 832df535f8..e02dbe2be1 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;
}