Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/dist/am-utils/libamu Pullup rev 1.2-1.3 (requested by a...
details: https://anonhg.NetBSD.org/src/rev/4b57172887c5
branches: netbsd-1-6
changeset: 531329:4b57172887c5
user: jmc <jmc%NetBSD.org@localhost>
date: Thu May 06 18:47:54 2004 +0000
description:
Pullup rev 1.2-1.3 (requested by aymeric in ticket #1681)
Avoid a cast between pointers to different integer sizes
diffstat:
dist/am-utils/libamu/misc_rpc.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diffs (47 lines):
diff -r 28a4ea2404db -r 4b57172887c5 dist/am-utils/libamu/misc_rpc.c
--- a/dist/am-utils/libamu/misc_rpc.c Thu May 06 18:41:01 2004 +0000
+++ b/dist/am-utils/libamu/misc_rpc.c Thu May 06 18:47:54 2004 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: misc_rpc.c,v 1.1.1.4 2001/05/13 17:50:31 veego Exp $ */
+/* $NetBSD: misc_rpc.c,v 1.1.1.4.2.1 2004/05/06 18:47:54 jmc Exp $ */
/*
- * Copyright (c) 1997-2001 Erez Zadok
+ * Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -38,9 +38,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * %W% (Berkeley) %G%
*
- * Id: misc_rpc.c,v 1.4.2.1 2001/01/10 03:23:39 ezk Exp
+ * Id: misc_rpc.c,v 1.10 2002/12/29 00:46:31 ib42 Exp
*
*/
@@ -129,6 +128,13 @@
{
XDR msg_xdr;
int len;
+ /*
+ * Never cast pointers between different integer types, it breaks badly
+ * on big-endian platforms if those types have different sizes.
+ *
+ * Cast to a local variable instead, and use that variable's address.
+ */
+ enum_t local_proc = (enum_t) proc;
xdrmem_create(&msg_xdr, buf, buflen, XDR_ENCODE);
@@ -141,7 +147,7 @@
/*
* Called procedure number
*/
- if (!xdr_enum(&msg_xdr, (enum_t *) & proc))
+ if (!xdr_enum(&msg_xdr, &local_proc))
return -EIO;
/*
Home |
Main Index |
Thread Index |
Old Index