we only support up to RT_TABLEID_MAX rtables.

ok?

(benno_bgpd_rtable_max.diff)

Index: parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/parse.y,v
retrieving revision 1.325
diff -u -p -r1.325 parse.y
--- parse.y     9 Jul 2018 12:05:11 -0000       1.325
+++ parse.y     10 Jul 2018 09:06:58 -0000
@@ -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;

Reply via email to