summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_debug.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-05-12 09:23:28 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-05-12 09:25:02 +0200
commit9b01d2898839422bb8ee14b6dccffb9d205cfbd7 (patch)
tree702e47d6ed4f619efa512d393d4784b0d8ed2b38 /bgpd/bgp_debug.c
parenttools: Catch more argv_find() when not checked properly (diff)
downloadfrr-9b01d2898839422bb8ee14b6dccffb9d205cfbd7.tar.xz
frr-9b01d2898839422bb8ee14b6dccffb9d205cfbd7.zip
bgpd: Check argv_find() value instead of the index
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_debug.c')
-rw-r--r--bgpd/bgp_debug.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 0993d6de5..74f9ca49d 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -627,8 +627,8 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
int argc, struct prefix **argv_pp)
{
struct prefix *argv_p;
- struct ethaddr mac;
- struct ipaddr ip;
+ struct ethaddr mac = {};
+ struct ipaddr ip = {};
int evpn_type = 0;
int mac_idx = 0;
int ip_idx = 0;
@@ -641,19 +641,19 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
if (evpn_type == BGP_EVPN_MAC_IP_ROUTE) {
memset(&ip, 0, sizeof(struct ipaddr));
- argv_find(argv, argc, "mac", &mac_idx);
- (void)prefix_str2mac(argv[mac_idx + 1]->arg, &mac);
+ if (argv_find(argv, argc, "mac", &mac_idx))
+ (void)prefix_str2mac(argv[mac_idx + 1]->arg, &mac);
- argv_find(argv, argc, "ip", &ip_idx);
- str2ipaddr(argv[ip_idx + 1]->arg, &ip);
+ if (argv_find(argv, argc, "ip", &ip_idx))
+ str2ipaddr(argv[ip_idx + 1]->arg, &ip);
build_evpn_type2_prefix((struct prefix_evpn *)argv_p,
&mac, &ip);
} else if (evpn_type == BGP_EVPN_IMET_ROUTE) {
memset(&ip, 0, sizeof(struct ipaddr));
- argv_find(argv, argc, "ip", &ip_idx);
- str2ipaddr(argv[ip_idx + 1]->arg, &ip);
+ if (argv_find(argv, argc, "ip", &ip_idx))
+ str2ipaddr(argv[ip_idx + 1]->arg, &ip);
build_evpn_type3_prefix((struct prefix_evpn *)argv_p,
ip.ipaddr_v4);