gcc.c (validate_switches): Robustify against skipping past '\0'.
authorLoren James Rittle <rittle@labs.mot.com>
Thu, 19 Dec 2002 05:22:53 +0000 (05:22 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Thu, 19 Dec 2002 05:22:53 +0000 (05:22 +0000)
2002-12-18  Loren James Rittle  <rittle@labs.mot.com>

* gcc.c (validate_switches): Robustify against skipping past '\0'.

From-SVN: r60283

gcc/ChangeLog
gcc/gcc.c

index 1f4c8710b6fe800e424ab4f9704d659ba00bc7cc..143b5c2aac054df9b33c5d69b5da47e7656791aa 100644 (file)
@@ -1,3 +1,7 @@
+2002-12-18  Loren James Rittle  <rittle@labs.mot.com>
+
+       * gcc.c (validate_switches): Robustify against skipping past '\0'.
+
 2002-12-18  Geoffrey Keating  <geoffk@apple.com>
 
        * config.gcc: Set extra_objs in the generic Darwin rule,
index dea12aac9351bc23d00bcd425491e89646553c58..85f792b678616ed051593e23008f71e0fe26e15e 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -6808,11 +6808,11 @@ next_member:
          switches[i].validated = 1;
     }
 
-  p++;
-  if (p[-1] == '|' || p[-1] == '&')
+  if (*p) p++;
+  if (*p && (p[-1] == '|' || p[-1] == '&'))
     goto next_member;
 
-  if (p[-1] == ':')
+  if (*p && p[-1] == ':')
     {
       while (*p && *p != ';' && *p != '}')
        {
@@ -6824,11 +6824,11 @@ next_member:
              else if (p[0] == 'W' && p[1] == '{')
                p = validate_switches (p+2);
            }
-         p++;
+         if (*p) p++;
        }
 
-      p++;
-      if (p[-1] == ';')
+      if (*p) p++;
+      if (*p && p[-1] == ';')
        goto next_member;
     }