about summary refs log tree commit diff
path: root/Src/glob.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2016-11-17 19:49:17 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2016-11-17 19:49:17 +0000
commita62e1640bcafbb82d86ea8d8ce057a83c4683d60 (patch)
treeb2e99365eb00070fd5b51f45d9cbb14fb1a17fd4 /Src/glob.c
parent297471cf7737c4dfe8097988b8a5bd61872df837 (diff)
downloadzsh-a62e1640bcafbb82d86ea8d8ce057a83c4683d60.tar.gz
zsh-a62e1640bcafbb82d86ea8d8ce057a83c4683d60.tar.xz
zsh-a62e1640bcafbb82d86ea8d8ce057a83c4683d60.zip
39958: Add extra byte to PATH_MAX allocations.
This ensures we've got enough space for a null, although this
isn't always needed.
Diffstat (limited to 'Src/glob.c')
-rw-r--r--Src/glob.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Src/glob.c b/Src/glob.c
index 50f6dceb3..33bf2ae18 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -283,7 +283,7 @@ addpath(char *s, int l)
 static int
 statfullpath(const char *s, struct stat *st, int l)
 {
-    char buf[PATH_MAX];
+    char buf[PATH_MAX+1];
 
     DPUTS(strlen(s) + !*s + pathpos - pathbufcwd >= PATH_MAX,
 	  "BUG: statfullpath(): pathname too long");
@@ -779,7 +779,7 @@ parsepat(char *str)
 
     /* Now there is no (#X) in front, we can check the path. */
     if (!pathbuf)
-	pathbuf = zalloc(pathbufsz = PATH_MAX);
+	pathbuf = zalloc(pathbufsz = PATH_MAX+1);
     DPUTS(pathbufcwd, "BUG: glob changed directory");
     if (*str == '/') {		/* pattern has absolute path */
 	str++;