Zsh Mailing List Archive
Messages sorted by:
Re: [PATCH] GNU canonicalize_file_name can return a NULL pointer
- X-seq: zsh-workers 30189
- From: "Timothy Redaelli" <timothy.redaelli@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] GNU canonicalize_file_name can return a NULL pointer
- Date: Tue, 07 Feb 2012 22:26:39 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=content-type:to:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=QoRuJi0lRssSMoqaxxgWqzkwXYO7yllZiZIwNrDPIss=; b=ACmzgVQk10nHzJgcvs4GoJJunl9IsPBWRn3ijHKWtsc4tSXaMAsUDNLC0Rdibj4Ccg H6mN2e521hoqEQC8uROZZ3mwKXcI0hg2L4idFKlatnuLBWQlaKXVjMWrjAsrVwk2XoBe iojcHpx3Yxj4TLZc/dR8RrocqLlP177xgMqI8=
- In-reply-to: <email@example.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <firstname.lastname@example.org> <email@example.com>
On Tue, 07 Feb 2012 21:10:58 +0100, Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
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.
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:
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'.
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).
Messages sorted by: