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>
This commit is contained in:
Steven Luong
committed by
steven luong
parent
0e1fe7ba86
commit
2da272e3da
@ -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;
|
||||
|
Reference in New Issue
Block a user