zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: stop null path component segfaults in whence
@ 2001-02-14 23:33 Clint Adams
  2001-02-15  6:24 ` Andrej Borsenkow
  0 siblings, 1 reply; 4+ messages in thread
From: Clint Adams @ 2001-02-14 23:33 UTC (permalink / raw)
  To: zsh-workers

% PATH=/usr/bin::/bin
% type -a type
will result in a segfault if your strlen() doesn't cope with NULL
(and I can't seem to find one that actually does)

This copes better, though I don't see much point in having an empty
element in the path.

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.41
diff -u -r1.41 builtin.c
--- Src/builtin.c	2001/01/26 12:47:37	1.41
+++ Src/builtin.c	2001/02/14 23:29:28
@@ -2468,14 +2468,14 @@
 	/* Option -a is to search the entire path, *
 	 * rather than just looking for one match. */
 	if (all) {
-	    char **pp, *buf, *z;
+	    char **pp, *buf;
 
 	    pushheap();
 	    for (pp = path; *pp; pp++) {
 		if (**pp) {
-		    z = dyncat(*pp, "/");
-		} else z = NULL;
-		buf = dyncat(z, *argv);
+		    buf = zhtricat(*pp, "/", *argv);
+		} else buf = ztrdup(*argv);
+
 		if (iscom(buf)) {
 		    if (wd) {
 			printf("%s: command\n", *argv);


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-02-15 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-14 23:33 PATCH: stop null path component segfaults in whence Clint Adams
2001-02-15  6:24 ` Andrej Borsenkow
2001-02-15  7:50   ` Bart Schaefer
2001-02-15 14:55   ` Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).