Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/rpc correct range check. from openbsd
details: https://anonhg.NetBSD.org/src/rev/ec19827bd77d
branches: trunk
changeset: 534659:ec19827bd77d
user: itojun <itojun%NetBSD.org@localhost>
date: Thu Aug 01 05:22:43 2002 +0000
description:
correct range check. from openbsd
diffstat:
lib/libc/rpc/xdr_array.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diffs (37 lines):
diff -r d1b400b9fb2c -r ec19827bd77d lib/libc/rpc/xdr_array.c
--- a/lib/libc/rpc/xdr_array.c Thu Aug 01 05:17:47 2002 +0000
+++ b/lib/libc/rpc/xdr_array.c Thu Aug 01 05:22:43 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xdr_array.c,v 1.13 2002/07/30 14:57:31 darrenr Exp $ */
+/* $NetBSD: xdr_array.c,v 1.14 2002/08/01 05:22:43 itojun Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -35,7 +35,7 @@
static char *sccsid = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";
static char *sccsid = "@(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC";
#else
-__RCSID("$NetBSD: xdr_array.c,v 1.13 2002/07/30 14:57:31 darrenr Exp $");
+__RCSID("$NetBSD: xdr_array.c,v 1.14 2002/08/01 05:22:43 itojun Exp $");
#endif
#endif
@@ -87,14 +87,13 @@
u_int nodesize;
/* like strings, arrays are really counted arrays */
- if (!xdr_u_int(xdrs, sizep)) {
+ if (!xdr_u_int(xdrs, sizep))
return (FALSE);
- }
+
c = *sizep;
- if ((c > maxsize && UINT_MAX/elsize < c) &&
- (xdrs->x_op != XDR_FREE)) {
+ if ((c > maxsize || UINT_MAX/elsize < c) &&
+ (xdrs->x_op != XDR_FREE))
return (FALSE);
- }
nodesize = c * elsize;
/*
Home |
Main Index |
Thread Index |
Old Index