diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-05-20 10:03:10 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-05-20 10:03:10 +0300 |
| commit | e0b1c8ccdf6821e4397edbba9e82dd6010ea2f8f (patch) | |
| tree | 04013cbe8f13818aa9f265fd067b46fe5d660b6d | |
| parent | cd0956e69ddd716163ac1a6b47db8982da2b856a (diff) | |
bgpd: Initialize pfx_buf to zeros before using in bgp_path_info_cmp()
This can lead into some garbage outputs, that can't be decoded in utf-8 or so.
This was catched when testing 76b246aa1f779e17ce6845c6ab0c292497b0008f.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
| -rw-r--r-- | bgpd/bgp_route.c | 4 | ||||
| -rw-r--r-- | bgpd/rfapi/rfapi_import.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4e4dce84fe..2046f74182 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1466,7 +1466,7 @@ int bgp_evpn_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, struct bgp_path_info *exist, int *paths_eq) { enum bgp_path_selection_reason reason; - char pfx_buf[PREFIX2STR_BUFFER]; + char pfx_buf[PREFIX2STR_BUFFER] = {}; return bgp_path_info_cmp(bgp, new, exist, paths_eq, NULL, 0, pfx_buf, AFI_L2VPN, SAFI_EVPN, &reason); @@ -2653,7 +2653,7 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest, struct bgp_path_info *nextpi = NULL; int paths_eq, do_mpath, debug; struct list mp_list; - char pfx_buf[PREFIX2STR_BUFFER]; + char pfx_buf[PREFIX2STR_BUFFER] = {}; char path_buf[PATH_ADDPATH_STR_BUFFER]; bgp_mp_list_init(&mp_list); diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c index 4b8e07a9c4..27f7c88d7b 100644 --- a/bgpd/rfapi/rfapi_import.c +++ b/bgpd/rfapi/rfapi_import.c @@ -1939,7 +1939,7 @@ static void rfapiBgpInfoAttachSorted(struct agg_node *rn, struct bgp *bgp; struct bgp_path_info *prev; struct bgp_path_info *next; - char pfx_buf[PREFIX2STR_BUFFER]; + char pfx_buf[PREFIX2STR_BUFFER] = {}; bgp = bgp_get_default(); /* assume 1 instance for now */ |
