summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-03-01 22:58:13 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-03-01 22:58:13 +0000
commit290380668b40ee8fce7be1039970a769e6eb0ac4 (patch)
treeafe98f930a6be85c499867247f239a06ed547688 /usr.sbin/bgpd
parente821f0a5218475484b5469ce1b12fdd2111787c8 (diff)
make sure AS doesn't exceed upper bound, issue pointed out by
Brent Graveland <brent@graveland.net>
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/parse.y15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index e9f20ba2a59..e532266a7b3 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.66 2004/03/01 17:04:07 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.67 2004/03/01 22:58:12 henning Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -111,7 +111,7 @@ typedef struct {
%token SET LOCALPREF MED NEXTHOP PREPEND
%token ERROR
%token <v.string> STRING
-%type <v.number> number optnumber yesno inout
+%type <v.number> number asnumber optnumber yesno inout
%type <v.string> string
%type <v.addr> address
%type <v.u8> action quick direction
@@ -142,6 +142,13 @@ number : STRING {
}
;
+asnumber : number {
+ if ($1 > USHRT_MAX) {
+ yyerror("AS too big: max %u", USHRT_MAX);
+ YYERROR;
+ }
+ }
+
string : string STRING {
if (asprintf(&$$, "%s %s", $1, $2) == -1)
fatal("string: asprintf");
@@ -169,7 +176,7 @@ varset : STRING '=' string {
}
;
-conf_main : AS number {
+conf_main : AS asnumber {
conf->as = $2;
}
| ROUTERID address {
@@ -345,7 +352,7 @@ peeroptsl : peeropts nl
| error nl
;
-peeropts : REMOTEAS number {
+peeropts : REMOTEAS asnumber {
curpeer->conf.remote_as = $2;
}
| DESCR string {