🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Eric Youngdale Sun, 13 Sep 1992 01:06
Bug in make 3.62
#834
Author: Eric Youngdale
Date: Sun, 13 Sep 1992 01:06
41 lines
2140 bytes
	I have found a bug in make-3.62, which can result in make crashing
with a segmentation fault.  I am enclosing a patch which fixes this.

	Basically the problem is that if we do not check to make sure that
p[l] is within the actual string we are looking at, then p[l] could have any
value.  I ran across a situation under linux where the string was "CC=cc",
and when we got to the test for word1eq ("ifndef", 6), it looked at the
character which was just after the terminating null in "CC=cc", and this number
turned out to be negative.  When it got to the isblank test, it was looking
in the ctype array with a negative index, and as it turned out, this
led to a segmentation fault.

	To fix this, I simply added a test to make sure that (strlen(p) > l)

	It might also be a good idea to change the data type of p and p2 to be
unsigned, as well.

-Eric

*** read.c.~1~	Thu Sep 10 23:46:15 1992
--- read.c	Sat Sep 12 21:35:36 1992
***************
*** 331,338 ****
        if (*p == '\0' && lb.buffer[0] != '\t')
  	continue;

! #define	word1eq(s, l) 	((p[l] == '\0' || isblank (p[l])) && \
! 			 !strncmp (s, p, l))
        if (word1eq ("ifdef", 5) || word1eq ("ifndef", 6)
  	  || word1eq ("ifeq", 4) || word1eq ("ifneq", 5)
  	  || word1eq ("else", 4) || word1eq ("endif", 5))
--- 331,339 ----
        if (*p == '\0' && lb.buffer[0] != '\t')
  	continue;

! #define	word1eq(s, l) 	(strlen(p) > l &&
! 			 ((p[l] == '\0' || isblank (p[l])) && \
! 			  !strncmp (s, p, l)))
        if (word1eq ("ifdef", 5) || word1eq ("ifndef", 6)
  	  || word1eq ("ifeq", 4) || word1eq ("ifneq", 5)
  	  || word1eq ("else", 4) || word1eq ("endif", 5))
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