From: "Timothy Redaelli" <timothy.redaelli@gmail.com>
To: zsh-workers@zsh.org
Subject: [PATCH] GNU canonicalize_file_name can return a NULL pointer
Date: Tue, 07 Feb 2012 19:45:48 +0100 [thread overview]
Message-ID: <op.v9bnqmm2tyqwli@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 306 bytes --]
Hi,
In Src/hist.c on line 1668 there is a NULL pointer dereference because GNU
canonicalize_file_name returns NULL on some errors.
In attachment you will find a small patch that fixes that bug.
If you want to reproduce it you can do (under GNU/Linux) a simple: zsh -c
'a=(a /b) ; echo ${a:A}'
Thanks
[-- Attachment #2: 0001-GNU-canonicalize_file_name-can-return-a-NULL-pointer.patch --]
[-- Type: application/octet-stream, Size: 677 bytes --]
From cd107ed1c3cc638f0d699516b544128d1b1c7f1d Mon Sep 17 00:00:00 2001
From: Timothy Redaelli <timothy.redaelli@gmail.com>
Date: Tue, 7 Feb 2012 19:36:42 +0100
Subject: [PATCH] GNU canonicalize_file_name can return a NULL pointer.
---
Src/hist.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Src/hist.c b/Src/hist.c
index aeb6edd..4d522dd 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1664,6 +1664,11 @@ chrealpath(char **junkptr)
errno == ENAMETOOLONG || errno == ENOMEM)
return 0;
+#ifdef HAVE_CANONICALIZE_FILE_NAME
+ if (!real)
+ return 0;
+#endif
+
if (nonreal == *junkptr) {
*real = '\0';
break;
--
1.7.9
next reply other threads:[~2012-02-07 18:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-07 18:45 Timothy Redaelli [this message]
2012-02-07 20:10 ` Frank Terbeck
2012-02-07 21:26 ` Timothy Redaelli
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=op.v9bnqmm2tyqwli@localhost.localdomain \
--to=timothy.redaelli@gmail.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).