]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: Prevent sending of uninited data to zebra
authorDonald Sharp <sharpd@nvidia.com>
Sat, 30 Jan 2021 19:15:54 +0000 (14:15 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Sat, 30 Jan 2021 19:15:54 +0000 (14:15 -0500)
Valgrind reports:
2172861-==2172861==
2172861-==2172861== Syscall param write(buf) points to uninitialised byte(s)
2172861:==2172861==    at 0x49B4FB3: write (write.c:26)
2172861-==2172861==    by 0x48A4EA0: buffer_write (buffer.c:475)
2172861-==2172861==    by 0x4915AD9: zclient_send_message (zclient.c:298)
2172861-==2172861==    by 0x12AE08: isis_ldp_sync_state_req_msg (isis_ldp_sync.c:152)
2172861-==2172861==    by 0x12B74B: isis_ldp_sync_adj_state_change (isis_ldp_sync.c:305)
2172861-==2172861==    by 0x16DE04: hook_call_isis_adj_state_change_hook.isra.0 (isis_adjacency.c:141)
2172861-==2172861==    by 0x16EE27: isis_adj_state_change (isis_adjacency.c:371)
2172861-==2172861==    by 0x16F1F3: isis_adj_process_threeway (isis_adjacency.c:242)
2172861-==2172861==    by 0x13BCCA: process_p2p_hello (isis_pdu.c:283)
2172861-==2172861==    by 0x13BCCA: process_hello (isis_pdu.c:781)
2172861-==2172861==    by 0x13BCCA: isis_handle_pdu (isis_pdu.c:1700)

Sending of request includes uninited memory at the end of the interface
name string.  Fix

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
isisd/isis_ldp_sync.c

index 00bef5c7829583f0d6214fc6b31f699718dcbdf5..585f76980650e3d4b83e5044a2491ae0efa92a34 100644 (file)
@@ -145,6 +145,7 @@ void isis_ldp_sync_state_req_msg(struct isis_circuit *circuit)
        ils_debug("ldp_sync: send state request to LDP for %s",
                  ifp->name);
 
+       memset(&request, 0, sizeof(request));
        strlcpy(request.name, ifp->name, sizeof(ifp->name));
        request.proto = LDP_IGP_SYNC_IF_STATE_REQUEST;
        request.ifindex = ifp->ifindex;