From: Donald Sharp Date: Sat, 4 May 2019 00:14:39 +0000 (-0400) Subject: zebra: Add some extra safety for route_info X-Git-Tag: frr-7.1~26^2~4 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=8dc7a759180b05a8270378f7f8d87e4338d99f05;hp=b705b4578e4d7e26d3397444e4c9cd3c6f6afd45;p=mirror_frr.git zebra: Add some extra safety for route_info The route_info[X].meta_q_map *must* be less than MQ_SIZE or we will do some strange stuff, so assert on it at startup. The distance in route_info is a uint8_t so let's keep the data structure the same. Signed-off-by: Donald Sharp --- diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 026fa41af..10be5d8fa 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -71,7 +71,7 @@ extern int allow_delete; /* Each route type's string and default distance value. */ static const struct { int key; - int distance; + uint8_t distance; uint8_t meta_q_map; } route_info[ZEBRA_ROUTE_MAX] = { [ZEBRA_ROUTE_SYSTEM] = {ZEBRA_ROUTE_SYSTEM, 0, 4}, @@ -3407,6 +3407,7 @@ static void check_route_info(void) if (i == ZEBRA_ROUTE_SYSTEM || i == ZEBRA_ROUTE_ALL) continue; assert(route_info[i].key); + assert(route_info[i].meta_q_map < MQ_SIZE); } }