From: Clint Adams <schizo@debian.org>
To: zsh-workers@sunsite.dk
Subject: PATCH: stop null path component segfaults in whence
Date: Wed, 14 Feb 2001 18:33:19 -0500 [thread overview]
Message-ID: <20010214183319.A11721@dman.com> (raw)
% 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);
next reply other threads:[~2001-02-14 23:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-14 23:33 Clint Adams [this message]
2001-02-15 6:24 ` Andrej Borsenkow
2001-02-15 7:50 ` Bart Schaefer
2001-02-15 14:55 ` Clint Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010214183319.A11721@dman.com \
--to=schizo@debian.org \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).