zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: "Timothy Redaelli" <timothy.redaelli@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] GNU canonicalize_file_name can return a NULL pointer
Date: Tue, 07 Feb 2012 21:10:58 +0100	[thread overview]
Message-ID: <87r4y6e759.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <op.v9bnqmm2tyqwli@localhost.localdomain> (Timothy Redaelli's message of "Tue, 07 Feb 2012 19:45:48 +0100")

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


  reply	other threads:[~2012-02-07 20:17 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 [this message]
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=87r4y6e759.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=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).