summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2004-12-06 20:17:04 +0000
committermiod <miod@openbsd.org>2004-12-06 20:17:04 +0000
commit967c46bef89016badc7a006065316c391da9f94c (patch)
treed60d7ab453ec4f28435d2c76c7fb57f01aa54df0
parentUse uvm_grow() to account for stack growth, rather than home-grown code (diff)
downloadwireguard-openbsd-967c46bef89016badc7a006065316c391da9f94c.tar.xz
wireguard-openbsd-967c46bef89016badc7a006065316c391da9f94c.zip
Do not access memory out of bounds when parsing input; fixes an incorrect
as behaviour when compiling sys/arch/mac68k/dev/if_ae.c with -pipe. ok tdeval@ deraadt@
-rw-r--r--gnu/usr.bin/gas/read.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gnu/usr.bin/gas/read.c b/gnu/usr.bin/gas/read.c
index c457288d885..d76fb6db1ba 100644
--- a/gnu/usr.bin/gas/read.c
+++ b/gnu/usr.bin/gas/read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read.c,v 1.11 2004/08/05 19:12:32 miod Exp $ */
+/* $OpenBSD: read.c,v 1.12 2004/12/06 20:17:04 miod Exp $ */
/* read.c - read a source file -
@@ -21,7 +21,7 @@
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef lint
-static char rcsid[] = "$OpenBSD: read.c,v 1.11 2004/08/05 19:12:32 miod Exp $";
+static char rcsid[] = "$OpenBSD: read.c,v 1.12 2004/12/06 20:17:04 miod Exp $";
#endif
#define MASK_CHAR (0xFF) /* If your chars aren't 8 bits, you will
@@ -425,7 +425,9 @@ char *name;
SKIP_WHITESPACE();
- } else if (c == '=' || input_line_pointer[1] == '=') { /* JF deal with FOO=BAR */
+ } else if (c == '=' ||
+ ((input_line_pointer + 1) < buffer_limit &&
+ input_line_pointer[1] == '=')) { /* JF deal with FOO=BAR */
equals(s);
demand_empty_rest_of_line();
} else { /* expect pseudo-op or machine instruction */