]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-xdr-updates-20020731
authorJeffrey Hutzelman <jhutz@cmu.edu>
Thu, 1 Aug 2002 00:13:49 +0000 (00:13 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 1 Aug 2002 00:13:49 +0000 (00:13 +0000)
update xdr so internal variables match what's being passed in

(cherry picked from commit 2d6ebd0cda81cff70a22a4393aaf58c5b7ccbb2e)

src/rx/xdr.c
src/rx/xdr_array.c
src/rx/xdr_arrayn.c

index 8ca8a4aec794d97ce6609096140006db5e166943..c1d07c0945691053c7b16b973f65455b80a1df2c 100644 (file)
@@ -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
         */
index ea5de24f5f0759809498bc1b622ce1fdb047ddb3..d49561095bb5b674c22cec0e6fd82ebc036a10c1 100644 (file)
@@ -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)) {
index e89322aa86251bf1e9af3e06b862422b70727ed5..70cb23f2f300ea408011899e41a2de1ebb95e0af 100644 (file)
@@ -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)) {