🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs
Article #576

Bug in "pathalias"

#576
From: John Sambrook
Date: Tue, 12 Aug 1986 03:53
44 lines
1979 bytes
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
Technical Details
Message-ID: <344@uw-nsr.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!sri-spam!parcvax!hplabs!tektronix!uw-beaver!tikal!sigma!uw-nsr!john

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!sri-spam!parcvax!hplabs!tektronix!uw-beaver!tikal!sigma!uw-nsr!john
From: john@uw-nsr.UUCP (John Sambrook)
Newsgroups: net.bugs
Subject: Bug in "pathalias"
Message-ID: <344@uw-nsr.UUCP>
Date: Mon, 11-Aug-86 23:53:51 EDT
Article-I.D.: uw-nsr.344
Posted: Mon Aug 11 23:53:51 1986
Date-Received: Wed, 13-Aug-86 01:20:57 EDT
Reply-To: john@uw-nsr.UUCP (John Sambrook 5-2018)
Organization: UW-Bioengineering, Seattle, WA
Lines: 43
Keywords: static, parse.y, yylex()