Re: [Bug-XBoard] [bug #31634] Bad path results in segmentation fault
From:
h.g. muller
Subject:
Re: [Bug-XBoard] [bug #31634] Bad path results in segmentation fault
Date:
Fri, 12 Nov 2010 23:37:55 +0100
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.