From: Renato Westphal Date: Fri, 19 Oct 2018 18:55:03 +0000 (-0300) Subject: bgpd: fix NULL pointer dereference bug X-Git-Tag: frr-6.0.1~6^2~5 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=87aaa2c05852812a9aa7947a83e9be89848e1df2;p=matthieu%2Ffrr.git bgpd: fix NULL pointer dereference bug Other parts of the rfapi code check if the 'rfg->rfapi_import_table' pointer is NULL or not before using it. Do the same here to fix a crash detected by the CLI fuzzer. Signed-off-by: Renato Westphal --- diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index cd12edbccb..871711312a 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -4844,6 +4844,10 @@ DEFUN (add_vrf_prefix_rd_label_pref, static int rfapi_cfg_group_it_count(struct rfapi_nve_group_cfg *rfg) { int count = 0; + + if (rfg->rfapi_import_table == NULL) + return 0; + afi_t afi = AFI_MAX; while (afi-- > 0) { count += rfg->rfapi_import_table->local_count[afi];