about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2000-09-17 16:24:05 +0000
committerClint Adams <clint@users.sourceforge.net>2000-09-17 16:24:05 +0000
commit2abf9db38184b94f45a07211014f08fe75ed8ee0 (patch)
treedd7206b94a88115a10fabaa2f2a731fbdfd18565
parentbd7969bfa568c91ee1875d62fda663c7468c030d (diff)
downloadzsh-2abf9db38184b94f45a07211014f08fe75ed8ee0.tar.gz
zsh-2abf9db38184b94f45a07211014f08fe75ed8ee0.tar.xz
zsh-2abf9db38184b94f45a07211014f08fe75ed8ee0.zip
12821: bin_dot is now independent of PATH_MAX
-rw-r--r--ChangeLog4
-rw-r--r--Src/builtin.c17
2 files changed, 12 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 9cc0f159c..377a1661e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-09-17  Clint Adams  <schizo@debian.org>
+
+	* 12821: Src/builtin.c: bin_dot is now independent of PATH_MAX.
+
 2000-09-16  Bart Schaefer  <schaefer@zsh.org>
 
 	* 12817: Doc/Zsh/builtins.yo, Src/builtin.c: Give meaning to
diff --git a/Src/builtin.c b/Src/builtin.c
index c62664e26..7fae149b0 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3259,11 +3259,10 @@ bin_dot(char *name, char **argv, char *ops, int func)
 {
     char **old, *old0 = NULL;
     int ret, diddot = 0, dotdot = 0;
-    char buf[PATH_MAX];
-    char *s, **t, *enam, *arg0;
+    char *s, **t, *enam, *arg0, *buf;
     struct stat st;
 
-    if (!*argv || strlen(*argv) >= PATH_MAX)
+    if (!*argv)
 	return 0;
     old = pparams;
     /* get arguments for the script */
@@ -3304,18 +3303,18 @@ bin_dot(char *name, char **argv, char *ops, int func)
 		    if (diddot)
 			continue;
 		    diddot = 1;
-		    strcpy(buf, arg0);
-		} else {
-		    if (strlen(*t) + strlen(arg0) + 1 >= PATH_MAX)
-			continue;
-		    sprintf(buf, "%s/%s", *t, arg0);
-		}
+		    buf = ztrdup(arg0);
+		} else
+		    buf = tricat(*t, "/", arg0);
+
 		s = unmeta(buf);
 		if (access(s, F_OK) == 0 && stat(s, &st) >= 0
 		    && !S_ISDIR(st.st_mode)) {
 		    ret = source(enam = buf);
+		    zsfree(buf);
 		    break;
 		}
+		zsfree(buf);
 	    }
 	}
     }