summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-03-15 16:19:03 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-03-15 16:19:03 +0000
commit4e21997d99bba966cb7bcf94c8c986448d4b6d75 (patch)
treef3d05dfdca189fb3e47b22d7c23255188cb44ab7 /usr.bin/ssh
parentbb6875f015e972c353dac4616e93affe94d56162 (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.bin/ssh')
-rw-r--r--usr.bin/ssh/monitor_fdpass.c6
1 files changed, 3 insertions, 3 deletions
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));