diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2018-07-10 09:55:15 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2018-07-10 09:55:15 +0000 |
commit | 7f5b7eaf45864db8e45814b5cb26f71afa9e7472 (patch) | |
tree | 37fc099eec2823db1a33552f507230f673f908b7 /usr.sbin/bgpd | |
parent | a54c5d3689cef38fdee28e1b1b87c7ff9e2a49cd (diff) |
dont let rtable number overflow,
we only support up to RT_TABLEID_MAX rtables
ok henning@, claudio@, phessler@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/parse.y | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 9759c2bb864..2b845b55092 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.325 2018/07/09 12:05:11 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.326 2018/07/10 09:55:14 benno Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -487,6 +487,11 @@ conf_main : AS as4number { free($3); } | RDE RIB STRING RTABLE NUMBER { + if ($5 > RT_TABLEID_MAX) { + yyerror("rtable %llu too big: max %u", $5, + RT_TABLEID_MAX); + YYERROR; + } if (add_rib($3, $5, 0)) { free($3); YYERROR; @@ -495,6 +500,11 @@ conf_main : AS as4number { } | RDE RIB STRING RTABLE NUMBER FIBUPDATE yesno { int flags = 0; + if ($5 > RT_TABLEID_MAX) { + yyerror("rtable %llu too big: max %u", $5, + RT_TABLEID_MAX); + YYERROR; + } if ($7 == 0) flags = F_RIB_NOFIBSYNC; if (add_rib($3, $5, flags)) { @@ -631,6 +641,11 @@ conf_main : AS as4number { } | RTABLE NUMBER { struct rde_rib *rr; + if ($2 > RT_TABLEID_MAX) { + yyerror("rtable %llu too big: max %u", $2, + RT_TABLEID_MAX); + YYERROR; + } if (ktable_exists($2, NULL) != 1) { yyerror("rtable id %lld does not exist", $2); YYERROR; @@ -888,6 +903,11 @@ optnumber : /* empty */ { $$ = 0; } ; rdomain : RDOMAIN NUMBER optnl '{' optnl { + if ($2 > RT_TABLEID_MAX) { + yyerror("rtable %llu too big: max %u", $2, + RT_TABLEID_MAX); + YYERROR; + } if (ktable_exists($2, NULL) != 1) { yyerror("rdomain %lld does not exist", $2); YYERROR; |