Skip to content

Commit

Permalink
zebra: add the parameter check to avoid zebra crash issue which cause…
Browse files Browse the repository at this point in the history
…d by null pointer reference.

Signed-off-by: wangshengjun <[email protected]>
  • Loading branch information
wangshengjun committed Nov 12, 2021
1 parent f15d7a2 commit f189e5d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions zebra/zebra_nb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,12 @@ int lib_vrf_zebra_l3vni_id_modify(struct nb_cb_modify_args *args)

vrf = nb_running_get_entry(args->dnode, NULL, true);
zvrf = zebra_vrf_lookup_by_name(vrf->name);
if (!zvrf) {
snprintf(args->errmsg, args->errmsg_len,
"zebra vrf info not found for vrf:%s.",
vrf->name);
return NB_ERR;
}
vni = yang_dnode_get_uint32(args->dnode, NULL);
/* Note: This covers lib_vrf_zebra_prefix_only_modify() config
* along with l3vni config
Expand Down Expand Up @@ -1240,6 +1246,12 @@ int lib_vrf_zebra_l3vni_id_destroy(struct nb_cb_destroy_args *args)
case NB_EV_APPLY:
vrf = nb_running_get_entry(args->dnode, NULL, true);
zvrf = zebra_vrf_lookup_by_name(vrf->name);
if (!zvrf) {
snprintf(args->errmsg, args->errmsg_len,
"zebra vrf info not found for vrf:%s.",
vrf->name);
return NB_ERR;
}
vni = yang_dnode_get_uint32(args->dnode, NULL);

if (!zl3vni_lookup(vni))
Expand Down

0 comments on commit f189e5d

Please sign in to comment.