diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-03-15 16:19:03 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-03-15 16:19:03 +0000 |
commit | 4e21997d99bba966cb7bcf94c8c986448d4b6d75 (patch) | |
tree | f3d05dfdca189fb3e47b22d7c23255188cb44ab7 /sbin | |
parent | bb6875f015e972c353dac4616e93affe94d56162 (diff) |
Repair the simple cases for msg_controllen where it should just be
CMSG_SIZE(sizeof(int)), not sizeof(buffer) which may be larger because
of alignment; ok kettenis hshoexer
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/isakmpd/monitor_fdpass.c | 6 | ||||
-rw-r--r-- | sbin/mount_portal/activate.c | 4 | ||||
-rw-r--r-- | sbin/pflogd/privsep_fdpass.c | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/sbin/isakmpd/monitor_fdpass.c b/sbin/isakmpd/monitor_fdpass.c index aef0e998bd8..c12af7db584 100644 --- a/sbin/isakmpd/monitor_fdpass.c +++ b/sbin/isakmpd/monitor_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor_fdpass.c,v 1.14 2008/03/13 01:49:52 deraadt Exp $ */ +/* $OpenBSD: monitor_fdpass.c,v 1.15 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright 2001 Niels Provos <provos@citi.umich.edu> @@ -50,7 +50,7 @@ mm_send_fd(int socket, int fd) bzero(&msg, sizeof msg); msg.msg_control = (caddr_t)&cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); + msg.msg_controllen = CMSG_LEN(sizeof(int)); cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_len = CMSG_LEN(sizeof(int)); cmsg->cmsg_level = SOL_SOCKET; @@ -94,7 +94,7 @@ mm_receive_fd(int socket) msg.msg_iov = &vec; msg.msg_iovlen = 1; msg.msg_control = &cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); + msg.msg_controllen = CMSG_LEN(sizeof(int)); if ((n = recvmsg(socket, &msg, 0)) == -1) { log_error("mm_receive_fd: recvmsg"); diff --git a/sbin/mount_portal/activate.c b/sbin/mount_portal/activate.c index a3b1ed157ed..e7ee78da4d4 100644 --- a/sbin/mount_portal/activate.c +++ b/sbin/mount_portal/activate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: activate.c,v 1.7 2008/03/13 01:49:52 deraadt Exp $ */ +/* $OpenBSD: activate.c,v 1.8 2008/03/15 16:19:02 deraadt Exp $ */ /* $NetBSD: activate.c,v 1.5 1995/04/23 10:33:18 cgd Exp $ */ /* @@ -129,7 +129,7 @@ send_reply(int so, int fd, int error) */ if (fd >= 0) { msg.msg_control = (caddr_t)&cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); + msg.msg_controllen = CMSG_LEN(sizeof(int)); cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_len = CMSG_LEN(sizeof(int)); cmsg->cmsg_level = SOL_SOCKET; diff --git a/sbin/pflogd/privsep_fdpass.c b/sbin/pflogd/privsep_fdpass.c index f6e23dfe031..0f310f8c2dc 100644 --- a/sbin/pflogd/privsep_fdpass.c +++ b/sbin/pflogd/privsep_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep_fdpass.c,v 1.3 2008/03/13 01:49:53 deraadt Exp $ */ +/* $OpenBSD: privsep_fdpass.c,v 1.4 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright 2001 Niels Provos <provos@citi.umich.edu> @@ -63,7 +63,7 @@ send_fd(int sock, int fd) if (fd >= 0) { msg.msg_control = (caddr_t)&cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); + msg.msg_controllen = CMSG_LEN(sizeof(int)); cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_len = CMSG_LEN(sizeof(int)); cmsg->cmsg_level = SOL_SOCKET; @@ -105,7 +105,7 @@ receive_fd(int sock) msg.msg_iov = &vec; msg.msg_iovlen = 1; msg.msg_control = &cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); + msg.msg_controllen = CMSG_LEN(sizeof(int)); if ((n = recvmsg(sock, &msg, 0)) == -1) warn("%s: recvmsg", __func__); |