aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2023-07-18 23:25:15 -0700
committersteven luong <sluong@cisco.com>2023-07-19 06:37:29 +0000
commit2da272e3daf7d51dce2fcfea02d870427c3de970 (patch)
tree4a10246351916a74a4e92483551c3b6688f5031f /src/vcl
parent0e1fe7ba86ccb0ab43a9a7452fe601abc23f16ce (diff)
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 <sluong@cisco.com>
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/ldp.c1
1 files changed, 1 insertions, 0 deletions
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;