diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 627971d3f977..0478dc1b4815 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -830,7 +830,9 @@ static void pim_show_interfaces_single(struct vty *vty, const char *ifname, u_ch sec_list = json_object_new_array(); for (ALL_LIST_ELEMENTS_RO(pim_ifp->sec_addr_list, sec_node, sec_addr)) { json_object_array_add(sec_list, - json_object_new_string(prefix2str(&sec_addr->addr, pbuf, PREFIX2STR_BUFFER))); + json_object_new_string(prefix2str(&sec_addr->addr, + pbuf, + sizeof(pbuf)))); } json_object_object_add(json_row, "secondaryAddressList", sec_list); } @@ -926,7 +928,9 @@ static void pim_show_interfaces_single(struct vty *vty, const char *ifname, u_ch inet_ntoa(ifaddr), VTY_NEWLINE); for (ALL_LIST_ELEMENTS_RO(pim_ifp->sec_addr_list, sec_node, sec_addr)) { vty_out(vty, " %s%s", - prefix2str(&sec_addr->addr, pbuf, PREFIX2STR_BUFFER), VTY_NEWLINE); + prefix2str(&sec_addr->addr, + pbuf, + sizeof(pbuf)), VTY_NEWLINE); } } else { vty_out(vty, "Address : %s%s", inet_ntoa(ifaddr), VTY_NEWLINE); @@ -1611,9 +1615,9 @@ static void pim_show_neighbors_secondary(struct vty *vty) neigh_src_str, sizeof(neigh_src_str)); for (ALL_LIST_ELEMENTS_RO(neigh->prefix_list, prefix_node, p)) { - char neigh_sec_str[100]; + char neigh_sec_str[PREFIX2STR_BUFFER]; - prefix2str(p, neigh_sec_str, 100); + prefix2str(p, neigh_sec_str, sizeof(neigh_sec_str)); vty_out(vty, "%-9s %-15s %-15s %-15s%s", ifp->name, diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c index 1d58ce3ac63f..259ed44c714d 100644 --- a/pimd/pim_tlv.c +++ b/pimd/pim_tlv.c @@ -523,7 +523,7 @@ pim_parse_addr_ucast (struct prefix *p, p->family = AF_INET6; p->prefixlen = IPV6_MAX_PREFIXLEN; - memcpy(&p->u.prefix6, addr, 16); + memcpy(&p->u.prefix6, addr, sizeof(struct in6_addr)); addr += sizeof(struct in6_addr); break; diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 620137b33b57..27bd1370438a 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -252,12 +252,16 @@ static int zclient_read_nexthop(struct zclient *zlookup, break; case NEXTHOP_TYPE_IPV6_IFINDEX: nexthop_tab[num_ifindex].nexthop_addr.family = AF_INET6; - stream_get (&nexthop_tab[num_ifindex].nexthop_addr.u.prefix6, s, 16); + stream_get (&nexthop_tab[num_ifindex].nexthop_addr.u.prefix6, + s, + sizeof(struct in6_addr)); nexthop_tab[num_ifindex].ifindex = stream_getl (s); p.family = AF_INET6; p.prefixlen = IPV6_MAX_PREFIXLEN; - memcpy (&p.u.prefix6, &nexthop_tab[num_ifindex].nexthop_addr.u.prefix6, 16); + memcpy (&p.u.prefix6, + &nexthop_tab[num_ifindex].nexthop_addr.u.prefix6, + sizeof(struct in6_addr)); /* * If we are sending v6 secondary assume we receive v6 secondary