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 <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2018-10-19 15:55:03 -03:00
parent 8a00500231
commit 7f5f853d0b

View File

@ -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];