diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-07-08 10:26:03 +0200 |
---|---|---|
committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-07-10 21:37:35 +0200 |
commit | 4bd04364adb27e18052730a54ee9a85ae12386c2 (patch) | |
tree | 6409622253c8e06902e684ff408b2de5341641ca /zebra/interface.c | |
parent | zebra: Check if ifp is not NULL in zebra_if_update_ctx() (diff) | |
download | frr-4bd04364adb27e18052730a54ee9a85ae12386c2.tar.xz frr-4bd04364adb27e18052730a54ee9a85ae12386c2.zip |
zebra: Guard printing an error by checking if VRF is not NULL
Check if vrf_lookup_by_id() didn't return a NULL before dereferencing in
flor_err().
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to '')
-rw-r--r-- | zebra/interface.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index cf36594b3..4c9f9f309 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1531,10 +1531,16 @@ static void interface_vrf_change(enum dplane_op_e op, ifindex_t ifindex, if (exist_id != VRF_DEFAULT) { vrf = vrf_lookup_by_id(exist_id); - flog_err( - EC_ZEBRA_VRF_MISCONFIGURED, - "VRF %s id %u table id overlaps existing vrf %s(%d), misconfiguration exiting", - name, ifindex, vrf->name, vrf->vrf_id); + if (vrf) + flog_err(EC_ZEBRA_VRF_MISCONFIGURED, + "VRF %s id %u table id overlaps existing vrf %s(%d), misconfiguration exiting", + name, ifindex, vrf->name, + vrf->vrf_id); + else + flog_err(EC_ZEBRA_VRF_NOT_FOUND, + "VRF %s id %u does not exist", + name, ifindex); + exit(-1); } } |