summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-08-12 15:11:25 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-08-12 15:11:25 +0000
commit89736c35ab1e1c84fb217a5e36c9caa883ae8834 (patch)
treeab04f937ff8cf4c623122dfc282a573ecf453641
parent6d5cfbaabf0fa36f10b2e5c0428d17d244491004 (diff)
Avoid dereferencing outside the bounds of an array. Found by mmap
malloc and reproducible via guard pages. OK deraadt@ miod@ tdeval@
-rw-r--r--gnu/usr.bin/gcc/gcc/gcc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gnu/usr.bin/gcc/gcc/gcc.c b/gnu/usr.bin/gcc/gcc/gcc.c
index 08a37cdf947..e3e8255d7cf 100644
--- a/gnu/usr.bin/gcc/gcc/gcc.c
+++ b/gnu/usr.bin/gcc/gcc/gcc.c
@@ -6678,9 +6678,9 @@ used_arg (p, len)
them. */
for (i = 0; i < n_mdswitches; i++)
{
- const char *r;
+ const char *r, *eq;
- for (q = multilib_options; *q != '\0'; q++)
+ for (q = multilib_options, eq = q + strlen(q); q < eq; q++)
{
while (*q == ' ')
q++;