From: Renato Westphal Date: Fri, 19 Oct 2018 18:55:03 +0000 (-0300) Subject: bgpd: fix NULL pointer dereference bug X-Git-Tag: frr-7.1-dev~253^2~6 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7f5f853d0b8b71c84dad23c1b3d883f6962cd26f;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 cdf281f240..1844839f25 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -4845,6 +4845,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];