[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-XBoard] [bug #31634] Bad path results in segmentation fault
From: |
Vincent Legout |
Subject: |
Re: [Bug-XBoard] [bug #31634] Bad path results in segmentation fault |
Date: |
Sat, 20 Nov 2010 11:01:09 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi,
On Fri, Nov 12, 2010 at 11:37:55PM +0100, h.g. muller wrote :
> I don't think this is the correct patch.
>
> The true problem is the *strchr(buf, '/') = 0; statement in the else part.
> This assumes that in any pathname starting with ~ there will be a slash,
> and causes the segfault if there is none. The patch merely diverts control
> to the else part in case there happens to be a space after the ~,
> but there are plenty cases with neither space nor slash, and they would
> keep segfaulting.
>
> I am a bit surprised to find this code anyway: I am not a Linux man, and
> I thought that ~ was a standard filename convention handled by the kernel,
> like it handles / as root. I was not aware that every application has to make
> the translation to home directory by itself. Yet this is what the code seems
> to be for.
>
> If this code indeed has to be kept, the proper solution would be to skip
> the assignment if there is no /, i.e.
>
> { char *p; if(p = strchr(buf, '/')) *p = 0; }
I think you're right about the ~ and your patch seems to work. I've applied it
against the current debian package in unstable (4.4.4), and I couldn't reproduce
the bug anymore.
Thanks,
Vincent