From: "Timothy Redaelli" <timothy.redaelli@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] GNU canonicalize_file_name can return a NULL pointer
Date: Tue, 07 Feb 2012 22:26:39 +0100 [thread overview]
Message-ID: <op.v9bu6pkotyqwli@localhost.localdomain> (raw)
In-Reply-To: <87r4y6e759.fsf@ft.bewatermyfriend.org>
On Tue, 07 Feb 2012 21:10:58 +0100, Frank Terbeck <ft@bewatermyfriend.org>
wrote:
> Timothy Redaelli wrote:
>> 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.
>
> Thanks!
>
> I've looked at the code and it bails out for a couple of errors in
> `errno'. I've looked at how canonicalize_file_name() is implemented by
> glibc, and it's just a short hand for "realpath(foo, NULL)". So at least
> on GNU systems the errors from realpath(3) apply to
> canonicalize_file_name(), too. Here's the current standard:
>
> <http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html>
>
> I don't know if it's worth checking all those or just go with bailing
> out if `real' is NULL.
>
> Both HAVE_REALPATH and HAVE_CANONICALIZE_FILE_NAME use a `real' pointer,
> so I think the "if (!null)" test should be in there unconditionally,
> without the `#ifdef'.
>
> Comments?
Hi,
in HAVE_REALPATH branch real it's not a point, but it's defined as
real[PATH_MAX] so it cannot be NULL.
We can make the if unconditionally, but it's quite useless (because it's
always false in the HAVE_REALPATH branch).
prev parent reply other threads:[~2012-02-07 21:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-07 18:45 Timothy Redaelli
2012-02-07 20:10 ` Frank Terbeck
2012-02-07 21:26 ` Timothy Redaelli [this message]
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.v9bu6pkotyqwli@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).