zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: Wrong PWD with chasedots
Date: Thu, 13 Nov 2014 19:44:54 +0000	[thread overview]
Message-ID: <20141113194454.6f9baaf0@pws-pc.ntlworld.com> (raw)
In-Reply-To: <20141113184620.GA2033@mlap.lactee>

On Thu, 13 Nov 2014 19:46:20 +0100
Marc Finet <m.dreadlock@gmail.com> wrote:
> I had some time to investigate and the problem lies in the
> utils.c::xsymlinks() where there is a discrepancy between the content of
> the global variable xbuf and the local value xbuflen:
>  - in the case a symlink is found, xsymlinks() is called,
>  - xbuf is updated but not xbuflen in the calling function
>  - later, when ".." is found, it is trimmed but uses xbuf + xbuflen as
>    starting point, not xbuf + its length. This leads to lose the data
>    set by xsymlinks(), i.e. the name of the sub-directories.
> This wrong behavior has been introduced by commit 3e06aeabd8a9e8384ebaa
> "32294: prevent buffer overflow when scanning very long directory paths
> for symbolic links".
>
> So I have two patches. The first one forces the xbuflen synchronization:

Thanks, I've applied this.

> While reading the xsymlinks() function I think that a (ret >= 0)
> condition should be added in the for() loop to exit early. Or a break
> should be added after setting ret to -1 in the case of error after
> symlink is found. Anyway, it's not homogeneous, but I do not know which
> method is 'cleaner'.

And this.

pws


      reply	other threads:[~2014-11-13 19:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11 10:35 Marc Finet
     [not found] ` <141111193532.ZM31133@torch.brasslantern.com>
2014-11-13 18:46   ` Marc Finet
2014-11-13 19:44     ` Peter Stephenson [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=20141113194454.6f9baaf0@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.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).