diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-09-20 14:24:25 +0200 |
---|---|---|
committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-09-20 14:25:29 +0200 |
commit | a914bd1643fb95fa82b884d3e719b129bc4665e7 (patch) | |
tree | 02876499cc092f3d843408e89c629aade98f9820 | |
parent | bgpd: Initialise prd despite if it's safi-related or not (diff) | |
download | frr-a914bd1643fb95fa82b884d3e719b129bc4665e7.tar.xz frr-a914bd1643fb95fa82b884d3e719b129bc4665e7.zip |
staticd: Check against NULL before dereferencing vrf
If VRF is not found by the given name, validate it and return an error.
Fixes: 76b2bc97e738 ("staticd: Accept full blackhole typed keywords for ip_route_cmd")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
-rw-r--r-- | staticd/static_nb_config.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/staticd/static_nb_config.c b/staticd/static_nb_config.c index 6673cce10..520a3ee2c 100644 --- a/staticd/static_nb_config.c +++ b/staticd/static_nb_config.c @@ -382,6 +382,13 @@ static int static_nexthop_bh_type_modify(struct nb_cb_modify_args *args) nh_vrf = yang_dnode_get_string(args->dnode, "../vrf"); if (nh_ifname && nh_vrf) { struct vrf *vrf = vrf_lookup_by_name(nh_vrf); + + if (!vrf) { + snprintf(args->errmsg, args->errmsg_len, + "nexthop vrf %s not found", nh_vrf); + return NB_ERR_VALIDATION; + } + struct interface *ifp = if_lookup_by_name(nh_ifname, vrf->vrf_id); |