]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Initialize pfx_buf to zeros before using in bgp_path_info_cmp()
authorDonatas Abraitis <donatas@opensourcerouting.org>
Sat, 20 May 2023 07:03:10 +0000 (10:03 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Sat, 20 May 2023 07:03:10 +0000 (10:03 +0300)
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>
bgpd/bgp_route.c
bgpd/rfapi/rfapi_import.c

index 4e4dce84fe7a0e6e2df353b607115ae964b13bc5..2046f741820423a1f1b6c933934d19383adbca0b 100644 (file)
@@ -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);
index 4b8e07a9c4c787b9c2daea8b752d533a3dae9f97..27f7c88d7be19841a443f1183953b10ab50b4d30 100644 (file)
@@ -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 */