]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: out-of-bounds access (Coverity 1399306)
authorpaco <paco@voltanet.io>
Fri, 15 Jun 2018 10:39:10 +0000 (12:39 +0200)
committerpaco <paco@voltanet.io>
Fri, 15 Jun 2018 10:39:10 +0000 (12:39 +0200)
Signed-off-by: F. Aragon <paco@voltanet.io>
bgpd/rfapi/bgp_rfapi_cfg.c

index 2f93328887efcf874b19fa67571c3e7d9ec62acc..72255e54fbd35b77830b866e9d5bf1e0d0070fd6 100644 (file)
@@ -662,7 +662,8 @@ static int rfapi_str2route_type(const char *l3str, const char *pstr, afi_t *afi,
                        vnc_import_bgp_exterior_redist_enable((bgp), (afi));   \
                        break;                                                 \
                default:                                                       \
-                       vnc_redistribute_set((bgp), (afi), (type));            \
+                       if ((type) < ZEBRA_ROUTE_MAX)                          \
+                               vnc_redistribute_set((bgp), (afi), (type));    \
                        break;                                                 \
                }                                                              \
        } while (0)
@@ -677,7 +678,8 @@ static int rfapi_str2route_type(const char *l3str, const char *pstr, afi_t *afi,
                        vnc_import_bgp_exterior_redist_disable((bgp), (afi));  \
                        break;                                                 \
                default:                                                       \
-                       vnc_redistribute_unset((bgp), (afi), (type));          \
+                       if ((type) < ZEBRA_ROUTE_MAX)                          \
+                               vnc_redistribute_unset((bgp), (afi), (type));  \
                        break;                                                 \
                }                                                              \
        } while (0)