Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: stop null path component segfaults in whence
- X-seq: zsh-workers 13478
- From: Clint Adams <schizo@xxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: stop null path component segfaults in whence
- Date: Wed, 14 Feb 2001 18:33:19 -0500
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
% 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);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author