mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 16:04:49 +00:00
bgpd: Check and validate return value for str2ipaddr()
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
9b01d28988
commit
7aad5e6a38
@ -642,10 +642,16 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
|
|||||||
memset(&ip, 0, sizeof(struct ipaddr));
|
memset(&ip, 0, sizeof(struct ipaddr));
|
||||||
|
|
||||||
if (argv_find(argv, argc, "mac", &mac_idx))
|
if (argv_find(argv, argc, "mac", &mac_idx))
|
||||||
(void)prefix_str2mac(argv[mac_idx + 1]->arg, &mac);
|
if (!prefix_str2mac(argv[mac_idx + 1]->arg, &mac)) {
|
||||||
|
vty_out(vty, "%% Malformed MAC address\n");
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
if (argv_find(argv, argc, "ip", &ip_idx))
|
if (argv_find(argv, argc, "ip", &ip_idx))
|
||||||
str2ipaddr(argv[ip_idx + 1]->arg, &ip);
|
if (str2ipaddr(argv[ip_idx + 1]->arg, &ip) != 0) {
|
||||||
|
vty_out(vty, "%% Malformed IP address\n");
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
build_evpn_type2_prefix((struct prefix_evpn *)argv_p,
|
build_evpn_type2_prefix((struct prefix_evpn *)argv_p,
|
||||||
&mac, &ip);
|
&mac, &ip);
|
||||||
@ -653,7 +659,10 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
|
|||||||
memset(&ip, 0, sizeof(struct ipaddr));
|
memset(&ip, 0, sizeof(struct ipaddr));
|
||||||
|
|
||||||
if (argv_find(argv, argc, "ip", &ip_idx))
|
if (argv_find(argv, argc, "ip", &ip_idx))
|
||||||
str2ipaddr(argv[ip_idx + 1]->arg, &ip);
|
if (str2ipaddr(argv[ip_idx + 1]->arg, &ip) != 0) {
|
||||||
|
vty_out(vty, "%% Malformed IP address\n");
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
build_evpn_type3_prefix((struct prefix_evpn *)argv_p,
|
build_evpn_type3_prefix((struct prefix_evpn *)argv_p,
|
||||||
ip.ipaddr_v4);
|
ip.ipaddr_v4);
|
||||||
|
Loading…
Reference in New Issue
Block a user