fourdan at xfce.org
Mon Jan 27 19:23:59 CET 2003
On Mon, 2003-01-27 at 18:03, edscott wilson garcia wrote:
> I'm attaching a patch with the corrections made to your last patch, and
> as you can see the code losses simplicity and is much longer (KISS). In
> the original code, using 256 character strings on the stack might seem
> overkill, but it's really a tradeoff to cut out a lot of code. POSIX
> says that paths are no more than 255, so there is really no segv
> posibility here.
Well I did not follow your thread, but what I can say is I definitely
prefer allocating a char* on the fly with the correct length to hold to
path rather than using fixed array length. It could be slower on
alloc/free, but definitely more secure. Nothing is worst than trying to
track down strings overruns of a single (or more) bytes because it can
very well work on some architectures and crash on other.
As for length of path, as far as I recall, it's 1024 or 4096, not 256,
but this is defined in a var called PATH_MAX defined in #include
<limits.h> on POSIX systems.
Olivier Fourdan <fourdan at xfce.org>
More information about the Xfce4-dev