From 2d6ebd0cda81cff70a22a4393aaf58c5b7ccbb2e Mon Sep 17 00:00:00 2001 From: Jeffrey Hutzelman Date: Thu, 1 Aug 2002 00:13:09 +0000 Subject: [PATCH] xdr-updates-20020731 update xdr so internal variables match what's being passed in --- src/rx/xdr.c | 2 ++ src/rx/xdr_array.c | 5 ++++- src/rx/xdr_arrayn.c | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/rx/xdr.c b/src/rx/xdr.c index 8ca8a4aec7..c1d07c0945 100644 --- a/src/rx/xdr.c +++ b/src/rx/xdr.c @@ -558,6 +558,8 @@ xdr_string(xdrs, cpp, maxsize) u_int size; u_int nodesize; + if (maxsize > ((~0) >> 1) - 1) maxsize = ((~0) >> 1) - 1; + /* * first deal with the length since xdr strings are counted-strings */ diff --git a/src/rx/xdr_array.c b/src/rx/xdr_array.c index ea5de24f5f..d49561095b 100644 --- a/src/rx/xdr_array.c +++ b/src/rx/xdr_array.c @@ -84,7 +84,10 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) register caddr_t target = *addrp; register u_int c; /* the actual element count */ register bool_t stat = TRUE; - register int nodesize; + register u_int nodesize; + + i = ((~0) >> 1) / elsize; + if (maxsize > i) maxsize = i; /* like strings, arrays are really counted arrays */ if (! xdr_u_int(xdrs, sizep)) { diff --git a/src/rx/xdr_arrayn.c b/src/rx/xdr_arrayn.c index e89322aa86..70cb23f2f3 100644 --- a/src/rx/xdr_arrayn.c +++ b/src/rx/xdr_arrayn.c @@ -89,7 +89,10 @@ bool_t xdr_arrayN(xdrs, addrp, sizep, maxsize, elsize, elproc) register caddr_t target = *addrp; register u_int c; /* the actual element count */ register bool_t stat = TRUE; - register int nodesize; + register u_int nodesize; + + i = ((~0) >> 1) / elsize; + if (maxsize > i) maxsize = i; /* like strings, arrays are really counted arrays */ if (! xdr_u_int(xdrs, sizep)) {