From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] Crash if $TMPPREFIX has invalid or read-only path
Date: Sun, 10 Sep 2023 20:38:27 -0700 [thread overview]
Message-ID: <CAH+w=7Zrkx06+NMZgW68Nct1cWPMAxMnvWbPsEozxJz6z9T+_w@mail.gmail.com> (raw)
Easily seen with
zsh -fc 'TMPPREFIX=/tmp/xxx/zsh; echo =(<<<"")'
getoutputfile() calls free() on memory that was allocated on the heap
by gettempname().
diff --git a/Src/exec.c b/Src/exec.c
index 8f9d5a885..3a8b3e951 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4897,7 +4897,6 @@ getoutputfile(char *cmd, char **eptr)
if ((fd = open(nam, O_WRONLY | O_CREAT | O_EXCL | O_NOCTTY, 0600)) < 0) {
zerr("process substitution failed: %e", errno);
- free(nam);
if (!s)
child_unblock();
return NULL;
reply other threads:[~2023-09-11 3:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='CAH+w=7Zrkx06+NMZgW68Nct1cWPMAxMnvWbPsEozxJz6z9T+_w@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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).