aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoren James Rittle <rittle@labs.mot.com>2002-12-19 05:22:53 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2002-12-19 05:22:53 +0000
commit5a0ba8c9eea209cab241dda53409c76d4a90d1c7 (patch)
tree4be85b1058de9879fa2ece0af7c873cde8cc482f
parent064b6c700a8923506af8fdacf4da8d7d6707e8f4 (diff)
downloadgcc-5a0ba8c9eea209cab241dda53409c76d4a90d1c7.zip
gcc-5a0ba8c9eea209cab241dda53409c76d4a90d1c7.tar.gz
gcc-5a0ba8c9eea209cab241dda53409c76d4a90d1c7.tar.bz2
gcc.c (validate_switches): Robustify against skipping past '\0'.
2002-12-18 Loren James Rittle <rittle@labs.mot.com> * gcc.c (validate_switches): Robustify against skipping past '\0'. From-SVN: r60283
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/gcc.c12
2 files changed, 10 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1f4c871..143b5c2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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,
diff --git a/gcc/gcc.c b/gcc/gcc.c
index dea12aa..85f792b 100644
--- 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;
}