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 | |
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
-rw-r--r-- | lib/libc/gen/auth_subr.c | 4 | ||||
-rw-r--r-- | libexec/ftpd/monitor_fdpass.c | 6 | ||||
-rw-r--r-- | libexec/login_skey/login_skey.c | 4 | ||||
-rw-r--r-- | libexec/login_tis/login_tis.c | 4 | ||||
-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 | ||||
-rw-r--r-- | usr.bin/ssh/monitor_fdpass.c | 6 | ||||
-rw-r--r-- | usr.sbin/bgpd/buffer.c | 6 | ||||
-rw-r--r-- | usr.sbin/relayd/buffer.c | 6 | ||||
-rw-r--r-- | usr.sbin/snmpd/buffer.c | 6 | ||||
-rw-r--r-- | usr.sbin/snmpd/imsg.c | 4 | ||||
-rw-r--r-- | usr.sbin/syslogd/privsep_fdpass.c | 6 | ||||
-rw-r--r-- | usr.sbin/tcpdump/privsep_fdpass.c | 6 |
14 files changed, 37 insertions, 37 deletions
diff --git a/lib/libc/gen/auth_subr.c b/lib/libc/gen/auth_subr.c index 0f4457e7bc1..405215c7216 100644 --- a/lib/libc/gen/auth_subr.c +++ b/lib/libc/gen/auth_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth_subr.c,v 1.33 2008/03/13 01:49:52 deraadt Exp $ */ +/* $OpenBSD: auth_subr.c,v 1.34 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright (c) 2000-2002,2004 Todd C. Miller <Todd.Miller@courtesan.com> @@ -995,7 +995,7 @@ _recv_fd(auth_session_t *as, int fd) memset(&msg, 0, sizeof(msg)); msg.msg_control = &cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); + msg.msg_controllen = CMSG_LEN(sizeof(int)); if (recvmsg(fd, &msg, 0) < 0) syslog(LOG_ERR, "recvmsg: %m"); else if (msg.msg_flags & MSG_TRUNC) diff --git a/libexec/ftpd/monitor_fdpass.c b/libexec/ftpd/monitor_fdpass.c index cc3d33d380d..94d116eadb6 100644 --- a/libexec/ftpd/monitor_fdpass.c +++ b/libexec/ftpd/monitor_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor_fdpass.c,v 1.2 2008/03/13 01:49:52 deraadt Exp $ */ +/* $OpenBSD: monitor_fdpass.c,v 1.3 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright (c) 2002 Matthieu Herrb @@ -44,7 +44,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; @@ -85,7 +85,7 @@ recv_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) syslog(LOG_WARNING, "recv_fd: recvmsg(%d): %m", sock); diff --git a/libexec/login_skey/login_skey.c b/libexec/login_skey/login_skey.c index 9a036c72e88..a47c162b9b3 100644 --- a/libexec/login_skey/login_skey.c +++ b/libexec/login_skey/login_skey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login_skey.c,v 1.20 2008/03/13 01:49:52 deraadt Exp $ */ +/* $OpenBSD: login_skey.c,v 1.21 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright (c) 2000, 2001, 2004 Todd C. Miller <Todd.Miller@courtesan.com> @@ -270,7 +270,7 @@ send_fd(int sock) memset(&msg, 0, sizeof(msg)); msg.msg_control = &cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); + msg.msg_controllen = CMSG_LEN(sizeof(int)); cmp = CMSG_FIRSTHDR(&msg); cmp->cmsg_len = CMSG_LEN(sizeof(int)); diff --git a/libexec/login_tis/login_tis.c b/libexec/login_tis/login_tis.c index ca436dd5897..25792b28213 100644 --- a/libexec/login_tis/login_tis.c +++ b/libexec/login_tis/login_tis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login_tis.c,v 1.7 2008/03/13 01:49:52 deraadt Exp $ */ +/* $OpenBSD: login_tis.c,v 1.8 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com> @@ -296,7 +296,7 @@ send_fd(struct tis_connection *tc, int sock) memset(&msg, 0, sizeof(msg)); msg.msg_control = &cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); + msg.msg_controllen = CMSG_LEN(sizeof(int)); cmp = CMSG_FIRSTHDR(&msg); cmp->cmsg_len = CMSG_LEN(sizeof(int)); 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__); diff --git a/usr.bin/ssh/monitor_fdpass.c b/usr.bin/ssh/monitor_fdpass.c index 1de4339a7c2..24cd59800db 100644 --- a/usr.bin/ssh/monitor_fdpass.c +++ b/usr.bin/ssh/monitor_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor_fdpass.c,v 1.15 2008/03/13 01:49:53 deraadt Exp $ */ +/* $OpenBSD: monitor_fdpass.c,v 1.16 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright 2001 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -50,7 +50,7 @@ mm_send_fd(int sock, int fd) memset(&msg, 0, 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; @@ -96,7 +96,7 @@ mm_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) { error("%s: recvmsg: %s", __func__, strerror(errno)); diff --git a/usr.sbin/bgpd/buffer.c b/usr.sbin/bgpd/buffer.c index f9a33dc9076..77a8fbef91a 100644 --- a/usr.sbin/bgpd/buffer.c +++ b/usr.sbin/bgpd/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.37 2008/03/13 01:49:53 deraadt Exp $ */ +/* $OpenBSD: buffer.c,v 1.38 2008/03/15 16:19:00 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -178,9 +178,9 @@ msgbuf_write(struct msgbuf *msgbuf) if (buf != NULL && buf->fd != -1) { 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_len = msg.msg_controllen; cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; *(int *)CMSG_DATA(cmsg) = buf->fd; diff --git a/usr.sbin/relayd/buffer.c b/usr.sbin/relayd/buffer.c index 31de258f42f..52f5bac4465 100644 --- a/usr.sbin/relayd/buffer.c +++ b/usr.sbin/relayd/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.10 2008/03/13 01:49:53 deraadt Exp $ */ +/* $OpenBSD: buffer.c,v 1.11 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -181,7 +181,7 @@ msgbuf_write(struct msgbuf *msgbuf) if (buf != NULL && buf->fd != -1) { 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; @@ -204,7 +204,7 @@ msgbuf_write(struct msgbuf *msgbuf) if (buf != NULL && buf->fd != -1) { 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/usr.sbin/snmpd/buffer.c b/usr.sbin/snmpd/buffer.c index 6882a4addfa..361746cad07 100644 --- a/usr.sbin/snmpd/buffer.c +++ b/usr.sbin/snmpd/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.2 2008/03/13 01:49:53 deraadt Exp $ */ +/* $OpenBSD: buffer.c,v 1.3 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -181,7 +181,7 @@ msgbuf_write(struct msgbuf *msgbuf) if (buf != NULL && buf->fd != -1) { 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; @@ -204,7 +204,7 @@ msgbuf_write(struct msgbuf *msgbuf) if (buf != NULL && buf->fd != -1) { 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/usr.sbin/snmpd/imsg.c b/usr.sbin/snmpd/imsg.c index 10f4c43934d..821036f86b6 100644 --- a/usr.sbin/snmpd/imsg.c +++ b/usr.sbin/snmpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.3 2008/03/13 01:49:53 deraadt Exp $ */ +/* $OpenBSD: imsg.c,v 1.4 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -68,7 +68,7 @@ imsg_read(struct imsgbuf *ibuf) msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = &cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); + msg.msg_controllen = CMSG_LEN(sizeof(int) * 16); if ((n = recvmsg(ibuf->fd, &msg, 0)) == -1) { if (errno != EINTR && errno != EAGAIN) { diff --git a/usr.sbin/syslogd/privsep_fdpass.c b/usr.sbin/syslogd/privsep_fdpass.c index 85dc100b88f..03105f9835d 100644 --- a/usr.sbin/syslogd/privsep_fdpass.c +++ b/usr.sbin/syslogd/privsep_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep_fdpass.c,v 1.5 2008/03/13 01:49:53 deraadt Exp $ */ +/* $OpenBSD: privsep_fdpass.c,v 1.6 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", "receive_fd"); diff --git a/usr.sbin/tcpdump/privsep_fdpass.c b/usr.sbin/tcpdump/privsep_fdpass.c index 8dde85d5c9d..bba8d85e4b9 100644 --- a/usr.sbin/tcpdump/privsep_fdpass.c +++ b/usr.sbin/tcpdump/privsep_fdpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep_fdpass.c,v 1.5 2008/03/13 01:49:53 deraadt Exp $ */ +/* $OpenBSD: privsep_fdpass.c,v 1.6 2008/03/15 16:19:02 deraadt Exp $ */ /* * Copyright (c) 2002 Matthieu Herrb @@ -46,7 +46,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; @@ -87,7 +87,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__); |