Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] GNU canonicalize_file_name can return a NULL pointer
- X-seq: zsh-workers 30188
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: "Timothy Redaelli" <timothy.redaelli@xxxxxxxxx>
- Subject: Re: [PATCH] GNU canonicalize_file_name can return a NULL pointer
- Date: Tue, 07 Feb 2012 21:10:58 +0100
- Cc: zsh-workers@xxxxxxx
- In-reply-to: <op.v9bnqmm2tyqwli@localhost.localdomain> (Timothy Redaelli's message of "Tue, 07 Feb 2012 19:45:48 +0100")
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <op.v9bnqmm2tyqwli@localhost.localdomain>
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?
Regards, Frank
Messages sorted by:
Reverse Date,
Date,
Thread,
Author