]> git.puffer.fish Git - mirror/frr.git/commitdiff
Merge pull request #11177 from opensourcerouting/fix/memset_memcpy
authorDonald Sharp <donaldsharp72@gmail.com>
Fri, 13 May 2022 11:40:58 +0000 (07:40 -0400)
committerGitHub <noreply@github.com>
Fri, 13 May 2022 11:40:58 +0000 (07:40 -0400)
*: memcpy/memset zeroing

1  2 
bgpd/bgp_debug.c
bgpd/bgp_evpn_mh.c
bgpd/bgp_evpn_vty.c
bgpd/bgp_route.c
bgpd/bgpd.c

index 7712274b58ba053b9d8e94dbf6e1a89c1b8e7495,ef71b191fa3deb546567b099705a81217d1d5f2e..57f37c173f6e38012431077c7b6fc6874c530d72
@@@ -639,30 -639,21 +639,30 @@@ static int bgp_debug_parse_evpn_prefix(
                return CMD_WARNING;
  
        if (evpn_type == BGP_EVPN_MAC_IP_ROUTE) {
-               memset(&ip, 0, sizeof(struct ipaddr));
+               memset(&ip, 0, sizeof(ip));
  
 -              argv_find(argv, argc, "mac", &mac_idx);
 -              (void)prefix_str2mac(argv[mac_idx + 1]->arg, &mac);
 +              if (argv_find(argv, argc, "mac", &mac_idx))
 +                      if (!prefix_str2mac(argv[mac_idx + 1]->arg, &mac)) {
 +                              vty_out(vty, "%% Malformed MAC address\n");
 +                              return CMD_WARNING;
 +                      }
  
 -              argv_find(argv, argc, "ip", &ip_idx);
 -              str2ipaddr(argv[ip_idx + 1]->arg, &ip);
 +              if (argv_find(argv, argc, "ip", &ip_idx))
 +                      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,
                                        &mac, &ip);
        } else if (evpn_type == BGP_EVPN_IMET_ROUTE) {
-               memset(&ip, 0, sizeof(struct ipaddr));
+               memset(&ip, 0, sizeof(ip));
  
 -              argv_find(argv, argc, "ip", &ip_idx);
 -              str2ipaddr(argv[ip_idx + 1]->arg, &ip);
 +              if (argv_find(argv, argc, "ip", &ip_idx))
 +                      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,
                                        ip.ipaddr_v4);
Simple merge
Simple merge
Simple merge
diff --cc bgpd/bgpd.c
Simple merge