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

* RE: PATCH: stop null path component segfaults in whence
  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
  0 siblings, 2 replies; 4+ messages in thread
From: Andrej Borsenkow @ 2001-02-15  6:24 UTC (permalink / raw)
  To: Clint Adams, zsh-workers

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

Empty element in PATH traditionally means current directory. Is it now
different in zsh?


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

* Re: PATCH: stop null path component segfaults in whence
  2001-02-15  6:24 ` Andrej Borsenkow
@ 2001-02-15  7:50   ` Bart Schaefer
  2001-02-15 14:55   ` Clint Adams
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2001-02-15  7:50 UTC (permalink / raw)
  To: zsh-workers

On Feb 15,  9:24am, Andrej Borsenkow wrote:
} Subject: RE: PATCH: stop null path component segfaults in whence
}
} Empty element in PATH traditionally means current directory. Is it now
} different in zsh?

No, it still results in an empty element of the $path array, which is
still interpreted as the current directory.

Or at least it worked that way in the build I just did, which unless I've
broken something else should have this patch in it.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: PATCH: stop null path component segfaults in whence
  2001-02-15  6:24 ` Andrej Borsenkow
  2001-02-15  7:50   ` Bart Schaefer
@ 2001-02-15 14:55   ` Clint Adams
  1 sibling, 0 replies; 4+ messages in thread
From: Clint Adams @ 2001-02-15 14:55 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: zsh-workers

> Empty element in PATH traditionally means current directory. Is it now
> different in zsh?

I hadn't thought about it, but that would be the behavior exhibited after
the patch.


^ 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).