Mail Archives: djgpp/1994/03/14/19:03:15
> I am using DJGPP 1.11m3 and found the following bug:
>
> stat() causes a big crash when called with relative filenames
> longer then (90 - length of <current working directory>), because
> there is a stack buffer p[90] used.
>
> The buffer p[] should probably changed to:
>
> char *p = (char *) alloca (strlen(path) + MAXPATHLEN);
Gack! I'm the one who wrote this, and I completely missed this
problem. The "alloca" solution should work fine, although I tend to
shy away from alloca since it's non-standard.
An alternative solution would be to fix the "_fixpath()" function,
found in libsrc/gen/fixpath.c, to stop after filling up PATH_MAX
characters in the output string. It should probably then return an
error if the output path got truncated.
I believe PATH_MAX is only 80 (or is it 64) on DOS, so your call to
stat() should in theory fail, although it shouldn't blow up on you
like this.
--
Eric Backus
ericb AT lsid DOT hp DOT com
(206) 335-2495
- Raw text -