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/snmpd | |
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/snmpd')
-rw-r--r-- | usr.sbin/snmpd/buffer.c | 6 | ||||
-rw-r--r-- | usr.sbin/snmpd/imsg.c | 4 |
2 files changed, 5 insertions, 5 deletions
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) { |