]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd zebra: array overrun fixes (PVS-Studio) 2599/head
authorF. Aragon <paco@voltanet.io>
Mon, 2 Jul 2018 14:30:40 +0000 (16:30 +0200)
committerF. Aragon <paco@voltanet.io>
Tue, 3 Jul 2018 09:34:40 +0000 (11:34 +0200)
Signed-off-by: F. Aragon <paco@voltanet.io>
ospfd/ospf_flood.c
zebra/redistribute.c

index 820b8921767f65955c8da8c267f71632f9e10b6e..002c6bba8d7023a52743955ed84b09466c538be5 100644 (file)
@@ -91,7 +91,7 @@ struct external_info *ospf_external_info_check(struct ospf *ospf,
        p.prefix = lsa->data->id;
        p.prefixlen = ip_masklen(al->mask);
 
-       for (type = 0; type <= ZEBRA_ROUTE_MAX; type++) {
+       for (type = 0; type < ZEBRA_ROUTE_MAX; type++) {
                int redist_on = 0;
 
                redist_on =
index be53b74b3f1fd411edfa4fc66b17af46bb6b0534..1fee675cbfb51399b5335ba8747332a07c974ec7 100644 (file)
@@ -274,7 +274,7 @@ void zebra_redistribute_add(ZAPI_HANDLER_ARGS)
                        __func__, zebra_route_string(client->proto), afi,
                        zebra_route_string(type), zvrf_id(zvrf), instance);
 
-       if (afi == 0 || afi > AFI_MAX) {
+       if (afi == 0 || afi >= AFI_MAX) {
                zlog_warn("%s: Specified afi %d does not exist",
                          __PRETTY_FUNCTION__, afi);
                return;
@@ -320,7 +320,7 @@ void zebra_redistribute_delete(ZAPI_HANDLER_ARGS)
        STREAM_GETC(msg, type);
        STREAM_GETW(msg, instance);
 
-       if (afi == 0 || afi > AFI_MAX) {
+       if (afi == 0 || afi >= AFI_MAX) {
                zlog_warn("%s: Specified afi %d does not exist",
                          __PRETTY_FUNCTION__, afi);
                return;