🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by wsd Mon, 20 Feb 1989 00:37
gnu make bug
#1496
Author: wsd
Date: Mon, 20 Feb 1989 00:37
48 lines
1796 bytes
I am running on a sun4-110 running sunos4.0
My version of gnu make has the following version info:

	GNU Make version 3.05, by Richard Stallman and Roland McGrath.
	Copyright (C) 1988 Free Software Foundation, Inc.
	This is free software; see the source for copying conditions.
	There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
	PARTICULAR PURPOSE.

when I give it this makefile (the file is named crasher):

	cfiles = $(wildcard *.c)
	
	test:   ;
		echo cfiles  $(cfiles)

I get the following output:

	./make -f crasher

	echo cfiles
	cfiles

This is incorrect, as there are several .c files in the current
directory (I am running in the gnu make source directory).

When we examined the code, the bug raised its ugly head in
glob.c:glob_filename on line 432.

	directory_name = (char *)alloca (i);

where i is 0.  alloca returns the same value as it returned the
last time it was called (the previous line, when filename) was
allocated.  Then on line 448

	directory_name[i] = '\0';

since directory_name really points to filename, filename gets trashed.
Even if i is not 0, since directory_name has exactly i bytes allocated
to it, directory_name[i] is out of bounds.  For some reason this
works on a sun 3.

The correction we made (which works so far) is to change line 432 to
read
	  directory_name = (char *)alloca (i + 1);


Scott Draves and Nick Thompson
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads