From 2da272e3daf7d51dce2fcfea02d870427c3de970 Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Tue, 18 Jul 2023 23:25:15 -0700 Subject: vcl: zero out cmsg for recvmsg API When msg->msg_controllen is set in recvmsg, the caller wants to receive additional information about the messages. However, they might not always be available. In that case, we should clear cmsg since the caller uses CMSG_NXTHDR which might access uninitialized fields in cmsg. Type: fix Change-Id: Ifdf9634bfcb1427f7ae3812014a46bfd7f4bc473 Signed-off-by: Steven Luong --- src/vcl/ldp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/vcl') diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index ffe1673d0ef..2256a2b9061 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -1748,6 +1748,7 @@ ldp_make_cmsg (vls_handle_t vlsh, struct msghdr *msg) struct cmsghdr *cmsg; cmsg = CMSG_FIRSTHDR (msg); + memset (cmsg, 0, sizeof (*cmsg)); if (!vls_attr (vlsh, VPPCOM_ATTR_GET_IP_PKTINFO, (void *) &optval, &optlen)) return 0; -- cgit 1.2.3-korg