[monitor_fdpass.c]
     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
This commit is contained in:
Damien Miller 2008-03-27 10:54:44 +11:00
parent f92e063872
commit be71e2d972
2 changed files with 9 additions and 4 deletions

View File

@ -13,6 +13,11 @@
[monitor_fdpass.c]
Correct CMSG_SPACE and CMSG_LEN usage everywhere in the tree. Due to
an extensive discussion with otto, kettenis, millert, and hshoexer
- deraadt@cvs.openbsd.org 2008/03/15 16:19:02
[monitor_fdpass.c]
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
20080315
- (djm) [regress/test-exec.sh] Quote putty-related variables in case they are
@ -3781,4 +3786,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.4883 2008/03/26 23:53:23 djm Exp $
$Id: ChangeLog,v 1.4884 2008/03/26 23:54:44 djm Exp $

View File

@ -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.
@ -63,7 +63,7 @@ mm_send_fd(int sock, int fd)
msg.msg_accrightslen = sizeof(fd);
#else
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;
@ -121,7 +121,7 @@ mm_receive_fd(int sock)
msg.msg_accrightslen = sizeof(fd);
#else
msg.msg_control = &cmsgbuf.buf;
msg.msg_controllen = sizeof(cmsgbuf.buf);
msg.msg_controllen = CMSG_LEN(sizeof(int));
#endif
if ((n = recvmsg(sock, &msg, 0)) == -1) {