From cb5153db4e18b0a5e42c886bc5f969ab765c8933 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 15 Mar 2008 16:33:59 +0000 Subject: 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 --- usr.sbin/bind/lib/isc/unix/privsep_fdpass.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.sbin/bind') diff --git a/usr.sbin/bind/lib/isc/unix/privsep_fdpass.c b/usr.sbin/bind/lib/isc/unix/privsep_fdpass.c index dc3ebda4b5d..444889a8074 100644 --- a/usr.sbin/bind/lib/isc/unix/privsep_fdpass.c +++ b/usr.sbin/bind/lib/isc/unix/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:33:58 deraadt Exp $ */ /* * Copyright 2001 Niels Provos @@ -61,7 +61,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; @@ -102,7 +102,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__); -- cgit v1.2.3