about summary refs log tree commit diff
path: root/Src/utils.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/utils.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/utils.c')
-rw-r--r--Src/utils.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Src/utils.c b/Src/utils.c
index 151e9e4eb..7bbd5887f 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -845,7 +845,7 @@ ispwd(char *s)
     return 0;
 }
 
-static char xbuf[PATH_MAX*2];
+static char xbuf[PATH_MAX*2+1];
 
 /**/
 static char **
@@ -884,7 +884,7 @@ static int
 xsymlinks(char *s, int full)
 {
     char **pp, **opp;
-    char xbuf2[PATH_MAX*3], xbuf3[PATH_MAX*2];
+    char xbuf2[PATH_MAX*3+1], xbuf3[PATH_MAX*2+1];
     int t0, ret = 0;
     zulong xbuflen = strlen(xbuf);
 
@@ -1003,7 +1003,7 @@ print_if_link(char *s, int all)
 	*xbuf = '\0';
 	if (all) {
 	    char *start = s + 1;
-	    char xbuflink[PATH_MAX];
+	    char xbuflink[PATH_MAX+1];
 	    for (;;) {
 		if (xsymlinks(start, 0) > 0) {
 		    printf(" -> ");
@@ -1140,7 +1140,7 @@ finddir(char *s)
 	if(homenode.diff==1)
 	    homenode.diff = 0;
 	if(!finddir_full)
-	    finddir_full = zalloc(ffsz = PATH_MAX);
+	    finddir_full = zalloc(ffsz = PATH_MAX+1);
 	finddir_full[0] = 0;
 	return finddir_last = NULL;
     }
@@ -1644,7 +1644,7 @@ checkmailpath(char **s)
 	} else if (S_ISDIR(st.st_mode)) {
 	    LinkList l;
 	    DIR *lock = opendir(unmeta(*s));
-	    char buf[PATH_MAX * 2], **arr, **ap;
+	    char buf[PATH_MAX * 2 + 1], **arr, **ap;
 	    int ct = 1;
 
 	    if (lock) {
@@ -6916,7 +6916,7 @@ strsfx(char *s, char *t)
 static int
 upchdir(int n)
 {
-    char buf[PATH_MAX];
+    char buf[PATH_MAX+1];
     char *s;
     int err = -1;