diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-10-06 14:38:33 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-10-06 14:38:33 +0000 |
commit | b2b1f4059cf7534c34bf018d4591c9d2c850f905 (patch) | |
tree | 84b3ca9cce293c1c7fc40c0c0eff189b84d6b481 /sys/kern/uipc_socket2.c | |
parent | 05729edf7be50a8bca84376859afaba905094dff (diff) |
Make sure that all padding bytes in cmsgs are actually zero by memset
CMSG_SIZE(len) bytes of the mbuf.
Diffstat (limited to 'sys/kern/uipc_socket2.c')
-rw-r--r-- | sys/kern/uipc_socket2.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 72064f08861..dc8f23c9b2b 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket2.c,v 1.62 2015/07/08 07:21:50 mpi Exp $ */ +/* $OpenBSD: uipc_socket2.c,v 1.63 2015/10/06 14:38:32 claudio Exp $ */ /* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */ /* @@ -938,6 +938,7 @@ sbcreatecontrol(caddr_t p, int size, int type, int level) } } cp = mtod(m, struct cmsghdr *); + memset(cp, 0, CMSG_SPACE(size)); memcpy(CMSG_DATA(cp), p, size); m->m_len = CMSG_SPACE(size); cp->cmsg_len = CMSG_LEN(size); |