summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-03-15 16:25:01 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-03-15 16:25:01 +0000
commit8332edeb582077739f86f898af5876386fbefc00 (patch)
tree0bd3f1a3f041252e7c1653278f43184cce9771a3
parent76cd87afedab46927375dd0ceabdedd0d5d56714 (diff)
Repair more msg_controllen dealing with structures or arrays of
descriptors; ok hshoexer, also looked at by kettenis and henning
-rw-r--r--libexec/tftp-proxy/tftp-proxy.c4
-rw-r--r--libexec/tftpd/tftpd.c8
-rw-r--r--usr.sbin/bgpd/imsg.c4
-rw-r--r--usr.sbin/ospf6d/packet.c4
-rw-r--r--usr.sbin/ospfd/packet.c4
-rw-r--r--usr.sbin/ppp/ppp/bundle.c6
-rw-r--r--usr.sbin/relayd/imsg.c4
-rw-r--r--usr.sbin/ripd/packet.c4
8 files changed, 19 insertions, 19 deletions
diff --git a/libexec/tftp-proxy/tftp-proxy.c b/libexec/tftp-proxy/tftp-proxy.c
index 372731b1c3d..af1b35dbd69 100644
--- a/libexec/tftp-proxy/tftp-proxy.c
+++ b/libexec/tftp-proxy/tftp-proxy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftp-proxy.c,v 1.3 2008/03/13 01:49:52 deraadt Exp $
+/* $OpenBSD: tftp-proxy.c,v 1.4 2008/03/15 16:25:00 deraadt Exp $
*
* Copyright (c) 2005 DLS Internet Services
* Copyright (c) 2004, 2005 Camiel Dobbelaar, <cd@sentia.nl>
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
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(struct sockaddr_storage));
if (recvmsg(fd, &msg, 0) < 0) {
syslog(LOG_ERR, "recvmsg: %m");
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index b22b3f48d60..0fe4c9c1535 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftpd.c,v 1.60 2008/03/13 01:49:52 deraadt Exp $ */
+/* $OpenBSD: tftpd.c,v 1.61 2008/03/15 16:25:00 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -37,7 +37,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)tftpd.c 5.13 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$OpenBSD: tftpd.c,v 1.60 2008/03/13 01:49:52 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: tftpd.c,v 1.61 2008/03/15 16:25:00 deraadt Exp $";
#endif /* not lint */
/*
@@ -286,7 +286,7 @@ main(int argc, char *argv[])
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(struct sockaddr_storage));
n = recvmsg(fd, &msg, 0);
if (n < 0) {
@@ -330,7 +330,7 @@ main(int argc, char *argv[])
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(struct sockaddr_storage));
i = recvmsg(fd, &msg, 0);
if (i > 0)
diff --git a/usr.sbin/bgpd/imsg.c b/usr.sbin/bgpd/imsg.c
index a939876e637..c9b964507f7 100644
--- a/usr.sbin/bgpd/imsg.c
+++ b/usr.sbin/bgpd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.40 2008/03/13 01:49:53 deraadt Exp $ */
+/* $OpenBSD: imsg.c,v 1.41 2008/03/15 16:25:00 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -57,7 +57,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/ospf6d/packet.c b/usr.sbin/ospf6d/packet.c
index 96058ebfe52..d6d5e63edb9 100644
--- a/usr.sbin/ospf6d/packet.c
+++ b/usr.sbin/ospf6d/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.7 2008/03/13 01:49:53 deraadt Exp $ */
+/* $OpenBSD: packet.c,v 1.8 2008/03/15 16:25:00 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -147,7 +147,7 @@ recv_packet(int fd, short event, void *bula)
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(struct in6_pktinfo));
if ((r = recvmsg(fd, &msg, 0)) == -1) {
if (errno != EAGAIN && errno != EINTR)
diff --git a/usr.sbin/ospfd/packet.c b/usr.sbin/ospfd/packet.c
index 1f63836f7dc..d39e142db75 100644
--- a/usr.sbin/ospfd/packet.c
+++ b/usr.sbin/ospfd/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.23 2008/03/13 01:49:53 deraadt Exp $ */
+/* $OpenBSD: packet.c,v 1.24 2008/03/15 16:25:00 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -140,7 +140,7 @@ recv_packet(int fd, short event, void *bula)
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(struct sockaddr_dl));
if ((r = recvmsg(fd, &msg, 0)) == -1) {
if (errno != EAGAIN && errno != EINTR)
diff --git a/usr.sbin/ppp/ppp/bundle.c b/usr.sbin/ppp/ppp/bundle.c
index 17fad31be59..fd18a89d4ee 100644
--- a/usr.sbin/ppp/ppp/bundle.c
+++ b/usr.sbin/ppp/ppp/bundle.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: bundle.c,v 1.72 2008/03/13 01:49:53 deraadt Exp $
+ * $OpenBSD: bundle.c,v 1.73 2008/03/15 16:25:00 deraadt Exp $
*/
#include <sys/param.h>
@@ -1418,7 +1418,7 @@ bundle_ReceiveDatalink(struct bundle *bundle, int s)
msg.msg_iov = iov;
msg.msg_iovlen = 1; /* Only send the version at the first pass */
msg.msg_control = cmsgbuf.buf;
- msg.msg_controllen = sizeof cmsgbuf.buf;
+ msg.msg_controllen = CMSG_LEN(sizeof(int) * SEND_MAXFD);
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_len = sizeof cmsgbuf.buf;
cmsg->cmsg_level = SOL_SOCKET;
@@ -1591,7 +1591,7 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun)
msg.msg_iovlen = 1;
msg.msg_iov = iov;
msg.msg_control = &cmsgbuf.buf;
- msg.msg_controllen = CMSG_SPACE(sizeof(int) * nfd);
+ msg.msg_controllen = CMSG_LEN(sizeof(int) * nfd);
msg.msg_flags = 0;
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_len = msg.msg_controllen;
diff --git a/usr.sbin/relayd/imsg.c b/usr.sbin/relayd/imsg.c
index 5915b1fcdb3..d42dc9c252f 100644
--- a/usr.sbin/relayd/imsg.c
+++ b/usr.sbin/relayd/imsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg.c,v 1.12 2008/03/13 01:49:53 deraadt Exp $ */
+/* $OpenBSD: imsg.c,v 1.13 2008/03/15 16:25:00 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/ripd/packet.c b/usr.sbin/ripd/packet.c
index e314cbadeab..697abf93e69 100644
--- a/usr.sbin/ripd/packet.c
+++ b/usr.sbin/ripd/packet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.8 2008/03/13 01:49:53 deraadt Exp $ */
+/* $OpenBSD: packet.c,v 1.9 2008/03/15 16:24:58 deraadt Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -113,7 +113,7 @@ recv_packet(int fd, short event, void *bula)
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(struct sockaddr_dl));
if ((r = recvmsg(fd, &msg, 0)) == -1) {
if (errno != EINTR && errno != EAGAIN)