about summary refs log tree commit diff
path: root/Src/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/init.c')
-rw-r--r--Src/init.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Src/init.c b/Src/init.c
index 2118a5f5f..e3a6bda3a 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -780,7 +780,8 @@ setupvals(void)
      * initialize `PWD' from `HOME'      */
     if (ispwd(home))
 	pwd = ztrdup(home);
-    else if ((ptr = zgetenv("PWD")) && ispwd(ptr))
+    else if ((ptr = zgetenv("PWD")) && (strlen(ptr) < PATH_MAX) &&
+	     (ptr = metafy(ptr, -1, META_STATIC), ispwd(ptr)))
 	pwd = ztrdup(ptr);
     else
 	pwd = metafy(zgetcwd(), -1, META_DUP);