Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3]: src/sys/kern Pull up following revision(s) (requested by mart...
details: https://anonhg.NetBSD.org/src/rev/651ba0b5ca52
branches: netbsd-3
changeset: 577135:651ba0b5ca52
user: tron <tron%NetBSD.org@localhost>
date: Fri Sep 09 14:17:44 2005 +0000
description:
Pull up following revision(s) (requested by martin in ticket #746):
sys/kern/uipc_syscalls.c: revision 1.94
In adjust_rights() Use CMSG_SPACE() to calculate the number of
filedescriptors passed in this message - the counterpart in
unp_externalize does this as well.
Note that CMSG_SPACE(0) does not make sense, since it does not invoke
the alignment magic - so use CMSG_SPACE(sizeof(int)) and adjust the
calculated total later.
This fixes the postfix conection cache for 64bit platforms. Previously
the number of passed filed descriptors (nfds) would have been
calculeted too high, causing the fdrelease() of uninitialized junk.
diffstat:
sys/kern/uipc_syscalls.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r c38609fcd354 -r 651ba0b5ca52 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c Fri Sep 09 14:17:02 2005 +0000
+++ b/sys/kern/uipc_syscalls.c Fri Sep 09 14:17:44 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_syscalls.c,v 1.90.2.3 2005/09/09 14:17:02 tron Exp $ */
+/* $NetBSD: uipc_syscalls.c,v 1.90.2.4 2005/09/09 14:17:44 tron Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.90.2.3 2005/09/09 14:17:02 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.90.2.4 2005/09/09 14:17:44 tron Exp $");
#include "opt_ktrace.h"
#include "opt_pipe.h"
@@ -658,7 +658,8 @@
int nok;
int *fdv;
- nfd = (m->m_len - CMSG_LEN(0)) / sizeof(int);
+ nfd = m->m_len < CMSG_SPACE(sizeof(int)) ? 0
+ : (m->m_len - CMSG_SPACE(sizeof(int))) / sizeof(int) + 1;
nok = (len < CMSG_LEN(0)) ? 0 : ((len - CMSG_LEN(0)) / sizeof(int));
fdv = (int *) CMSG_DATA(mtod(m,struct cmsghdr *));
for (i = nok; i < nfd; i++)
Home |
Main Index |
Thread Index |
Old Index