From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23432 invoked by alias); 13 Nov 2014 19:50:31 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33690 Received: (qmail 5471 invoked from network); 13 Nov 2014 19:50:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Originating-IP: [80.3.229.105] X-Spam: 0 X-Authority: v=2.1 cv=N7qnFgNB c=1 sm=1 tr=0 a=uz1KDxDNIq33yePw376BBA==:117 a=uz1KDxDNIq33yePw376BBA==:17 a=NLZqzBF-AAAA:8 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=_vybOdVc5-3gmc-ln4UA:9 a=CjuIK1q_8ugA:10 Date: Thu, 13 Nov 2014 19:44:54 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Wrong PWD with chasedots Message-ID: <20141113194454.6f9baaf0@pws-pc.ntlworld.com> In-Reply-To: <20141113184620.GA2033@mlap.lactee> References: <20141111103527.GB8974@mlap.lactee> <141111193532.ZM31133@torch.brasslantern.com> <20141113184620.GA2033@mlap.lactee> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 13 Nov 2014 19:46:20 +0100 Marc Finet 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