Bug in "pathalias"
John Sambrook
john at uw-nsr.UUCP
Tue Aug 12 13:53:51 AEST 1986
The version of "pathalias" posted to mod.sources seems to contain a bug.
>From the "CHANGES" file it seems that we have the version distributed
on or about 1/86.
The bug concerns the function yylex() as contained in file "parse.y".
Within the body of yylex() there is a declaration of the variable
"buf" as follows:
char buf[BUFSIZ], errbuf[128];
Unfortunately, the value contained in buf is used after the function
has returned. For example, when a HOST token has been scanned the
following code is executed:
.
.
.
yylval.y_name = buf;
return(HOST);
}
Of course, as soon as the return statement is executed the value of
buf is no longer guaranteed. On many implementations this "happens"
to work, but it is not correct.
While this was tedious to find, it is easy to fix. Simply change the
old declaration to the following:
#if 0 /* bug fix */
char buf[BUFSIZ], errbuf[128];
#else
static char buf[BUFSIZ];
char errbuf[128];
#endif
After fixing this one minor problem "pathalias" works like a champ. I
should point out that very few programs have been as easy to port to our
system. We have a DG MV/10000 and we find all the "dereference through
NULL" bugs and then some :-)
--
John Sambrook Work: (206) 545-2018
University of Washington WD-12 Home: (206) 487-0180
Seattle, Washington 98195 UUCP: uw-beaver!uw-nsr!john
More information about the Net.bugs
mailing list