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 /usr.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 'usr.sbin')
-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 |
6 files changed, 17 insertions, 17 deletions
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__); |