From: Donald Sharp Date: Sat, 30 Jan 2021 19:13:34 +0000 (-0500) Subject: ospfd: Prevent sending of uninited data to zebra X-Git-Tag: base_8.0~440^2~4 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=dd53fd0832e1e30b7d8289678d46e56f6ab2e7a3;p=mirror%2Ffrr.git ospfd: Prevent sending of uninited data to zebra Valgrind reports: 2174600-==2174600== 2174600-==2174600== Syscall param write(buf) points to uninitialised byte(s) 2174600:==2174600== at 0x49C7FB3: write (write.c:26) 2174600-==2174600== by 0x48A4EA0: buffer_write (buffer.c:475) 2174600-==2174600== by 0x4915AD9: zclient_send_message (zclient.c:298) 2174600-==2174600== by 0x12DB97: ospf_ldp_sync_state_req_msg (ospf_ldp_sync.c:114) 2174600-==2174600== by 0x12E4F0: ospf_ldp_sync_if_start (ospf_ldp_sync.c:160) 2174600-==2174600== by 0x12E4F0: ospf_ldp_sync_ism_change (ospf_ldp_sync.c:339) 2174600-==2174600== by 0x12E4F0: ospf_ldp_sync_ism_change (ospf_ldp_sync.c:332) 2174600-==2174600== by 0x12C6A2: hook_call_ospf_ism_change (ospf_ism.c:46) 2174600-==2174600== by 0x12C6A2: ism_change_state (ospf_ism.c:540) 2174600-==2174600== by 0x12C6A2: ospf_ism_event (ospf_ism.c:600) 2174600-==2174600== by 0x4904846: thread_call (thread.c:1681) When we send the request structure we are sending the whole thing and the interface name string has junk at the end. Not a big deal, but cleans up valgrind going wumple on us. Signed-off-by: Donald Sharp --- diff --git a/ospfd/ospf_ldp_sync.c b/ospfd/ospf_ldp_sync.c index b574e2cac8..dbd45635b2 100644 --- a/ospfd/ospf_ldp_sync.c +++ b/ospfd/ospf_ldp_sync.c @@ -107,6 +107,7 @@ void ospf_ldp_sync_state_req_msg(struct interface *ifp) ols_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;