summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Rosenboim <lrosenbo@wrs.com>2012-12-06 20:17:41 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2013-01-14 16:07:25 +0100
commit9499bf2bc6daf0a9b7170d3cf994daef2f1a8920 (patch)
treeda0c36589c64c385b2f2ace17b92076febb9afe6
parent15c713485699fd22dfa5b7ce3ca7c6be049f1033 (diff)
zebra: don't overrun afi/safi array boundaries
zebra was not checking afi/safi values. This was leading to crashes where these values were coming directly from some protocol's on-wire fields. Safeguarding them in zebra is a good start. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--zebra/zebra_rib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index a75d7215..4dd8551a 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -155,6 +155,9 @@ vrf_table (afi_t afi, safi_t safi, u_int32_t id)
if (! vrf)
return NULL;
+ if( afi >= AFI_MAX || safi >= SAFI_MAX )
+ return NULL;
+
return vrf->table[afi][safi];
}
@@ -168,6 +171,9 @@ vrf_static_table (afi_t afi, safi_t safi, u_int32_t id)
if (! vrf)
return NULL;
+ if( afi >= AFI_MAX || safi >= SAFI_MAX )
+ return NULL;
+
return vrf->stable[afi][safi];
}