zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] GNU canonicalize_file_name can return a NULL pointer
@ 2012-02-07 18:45 Timothy Redaelli
  2012-02-07 20:10 ` Frank Terbeck
  0 siblings, 1 reply; 3+ messages in thread
From: Timothy Redaelli @ 2012-02-07 18:45 UTC (permalink / raw)
  To: zsh-workers

[-- 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


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

end of thread, other threads:[~2012-02-07 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-07 18:45 [PATCH] GNU canonicalize_file_name can return a NULL pointer Timothy Redaelli
2012-02-07 20:10 ` Frank Terbeck
2012-02-07 21:26   ` Timothy Redaelli

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