bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make 3.80 subscript error if environ has small string


From: Paul Eggert
Subject: make 3.80 subscript error if environ has small string
Date: Sun, 5 Oct 2003 22:51:50 -0700 (PDT)

GNU make 3.80 assumes that every string in the environment has at least
MAKELEVEL_LENGTH bytes in it, and it executes a subscript error otherwise.
Normally this is harmless, but....

Here is a patch.

2003-10-05  Paul Eggert  <address@hidden>

        * main.c (main):
        Avoid potential subscript error if environ has short strings.

===================================================================
RCS file: RCS/main.c,v
retrieving revision 3.80
retrieving revision 3.80.0.1
diff -pu -r3.80 -r3.80.0.1
--- main.c      2002/08/10 01:27:17     3.80
+++ main.c      2003/10/06 05:46:41     3.80.0.1
@@ -1845,8 +1845,8 @@ int main (int argc, char ** argv)
 
 #ifndef _AMIGA
          for (p = environ; *p != 0; ++p)
-           if ((*p)[MAKELEVEL_LENGTH] == '='
-               && strneq (*p, MAKELEVEL_NAME, MAKELEVEL_LENGTH))
+           if (strneq (*p, MAKELEVEL_NAME, MAKELEVEL_LENGTH)
+               && (*p)[MAKELEVEL_LENGTH] == '=')
              {
                /* The SGI compiler apparently can't understand
                   the concept of storing the result of a function




reply via email to

[Prev in Thread] Current Thread [Next in Thread]