diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index f5652b07c5..d716218d70 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -576,7 +576,7 @@ static void aspath_make_str_count(struct aspath *as, bool make_json) if (make_json) json_object_array_add( jseg_list, - json_object_new_int(seg->as[i])); + json_object_new_int64(seg->as[i])); len += snprintf(str_buf + len, str_size - len, "%u", seg->as[i]); diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 1156810510..e8d3062561 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -109,7 +109,7 @@ int bgp_nlri_parse_vpn(struct peer *peer, struct attr *attr, uint16_t type; struct rd_as rd_as; struct rd_ip rd_ip; - struct prefix_rd prd; + struct prefix_rd prd = {0}; mpls_label_t label = {0}; afi_t afi; safi_t safi; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 9dc4a294c4..c122df498a 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1785,9 +1785,9 @@ int subgroup_announce_check(struct bgp_node *rn, struct bgp_path_info *pi, /* Route map & unsuppress-map apply. */ if (ROUTE_MAP_OUT_NAME(filter) || (pi->extra && pi->extra->suppress)) { - struct bgp_path_info rmap_path; - struct bgp_path_info_extra dummy_rmap_path_extra; - struct attr dummy_attr; + struct bgp_path_info rmap_path = {0}; + struct bgp_path_info_extra dummy_rmap_path_extra = {0}; + struct attr dummy_attr = {0}; memset(&rmap_path, 0, sizeof(struct bgp_path_info)); rmap_path.peer = peer; @@ -3927,12 +3927,16 @@ static void bgp_soft_reconfig_table(struct peer *peer, afi_t afi, safi_t safi, if (ain->peer != peer) continue; - struct bgp_path_info *pi = - bgp_node_get_bgp_path_info(rn); + struct bgp_path_info *pi; uint32_t num_labels = 0; mpls_label_t *label_pnt = NULL; struct bgp_route_evpn evpn; + for (pi = bgp_node_get_bgp_path_info(rn); pi; + pi = pi->next) + if (pi->peer == peer) + break; + if (pi && pi->extra) num_labels = pi->extra->num_labels; if (num_labels) diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 87a05a4f8c..655cf747de 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -2179,8 +2179,8 @@ static struct bgp_path_info *rfapiItBiIndexSearch( { struct skiplist *sl; int rc; - struct bgp_path_info bpi_fake; - struct bgp_path_info_extra bpi_extra; + struct bgp_path_info bpi_fake = {0}; + struct bgp_path_info_extra bpi_extra = {0}; struct bgp_path_info *bpi_result; sl = RFAPI_RDINDEX(rn); diff --git a/lib/prefix.c b/lib/prefix.c index 35b679ab90..aa6661d7fb 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -773,8 +773,18 @@ int prefix_cmp(union prefixconstptr up1, union prefixconstptr up2) if (i) return i; - return numcmp(pp1[offset] & maskbit[shift], - pp2[offset] & maskbit[shift]); + /* + * At this point offset was the same, if we have shift + * that means we still have data to compare, if shift is + * 0 then we are at the end of the data structure + * and should just return, as that we will be accessing + * memory beyond the end of the party zone + */ + if (shift) + return numcmp(pp1[offset] & maskbit[shift], + pp2[offset] & maskbit[shift]); + + return 0; } /*