Skip to content

Commit

Permalink
bgpd: handle argv_find_and_parse_afi return value
Browse files Browse the repository at this point in the history
Handle the return value of argv_find_and_parse_afi() to avoid passing
along bad values.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
  • Loading branch information
rzalamena committed Dec 14, 2017
1 parent a90b8cb commit 1ad057a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bgpd/rfapi/bgp_rfapi_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,11 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
return CMD_WARNING_CONFIG_FAILED;
}

argv_find_and_parse_afi(argv, argc, &idx, &afi);
if (!argv_find_and_parse_afi(argv, argc, &idx, &afi)) {
vty_out(vty, "%% Malformed Address Family\n");
return CMD_WARNING_CONFIG_FAILED;
}

if (argv[idx-1]->text[0] == 'z')
is_bgp = 0;
idx += 2; /* skip afi and keyword */
Expand Down Expand Up @@ -1691,7 +1695,11 @@ DEFUN (vnc_nve_group_export_prefixlist,
return CMD_WARNING_CONFIG_FAILED;
}

argv_find_and_parse_afi(argv, argc, &idx, &afi);
if (!argv_find_and_parse_afi(argv, argc, &idx, &afi)) {
vty_out(vty, "%% Malformed Address Family\n");
return CMD_WARNING_CONFIG_FAILED;
}

if (argv[idx-1]->text[0] == 'z')
is_bgp = 0;
idx = argc - 1;
Expand Down

0 comments on commit 1ad057a

Please sign in to comment.