summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/rpc/rpc.32
-rw-r--r--lib/libc/xdr/xdr_mem.c22
-rw-r--r--lib/libc/xdr/xdr_sizeof.c6
3 files changed, 18 insertions, 12 deletions
diff --git a/lib/libc/rpc/rpc.3 b/lib/libc/rpc/rpc.3
index c6490d1..d1c19a4 100644
--- a/lib/libc/rpc/rpc.3
+++ b/lib/libc/rpc/rpc.3
@@ -280,7 +280,7 @@ typedef struct {
caddr_t x_public; /* users' data */
caddr_t x_private; /* pointer to private data */
caddr_t x_base; /* private used for position info */
- int x_handy; /* extra private word */
+ u_int x_handy; /* extra private word */
} XDR;
/*
diff --git a/lib/libc/xdr/xdr_mem.c b/lib/libc/xdr/xdr_mem.c
index 19ed188..c1d7594 100644
--- a/lib/libc/xdr/xdr_mem.c
+++ b/lib/libc/xdr/xdr_mem.c
@@ -126,8 +126,9 @@ xdrmem_getlong_aligned(xdrs, lp)
long *lp;
{
- if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ if (xdrs->x_handy < sizeof(int32_t))
return (FALSE);
+ xdrs->x_handy -= sizeof(int32_t);
*lp = ntohl(*(u_int32_t *)xdrs->x_private);
xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
return (TRUE);
@@ -139,8 +140,9 @@ xdrmem_putlong_aligned(xdrs, lp)
const long *lp;
{
- if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ if (xdrs->x_handy < sizeof(int32_t))
return (FALSE);
+ xdrs->x_handy -= sizeof(int32_t);
*(u_int32_t *)xdrs->x_private = htonl((u_int32_t)*lp);
xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
return (TRUE);
@@ -153,8 +155,9 @@ xdrmem_getlong_unaligned(xdrs, lp)
{
u_int32_t l;
- if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ if (xdrs->x_handy < sizeof(int32_t))
return (FALSE);
+ xdrs->x_handy -= sizeof(int32_t);
memmove(&l, xdrs->x_private, sizeof(int32_t));
*lp = ntohl(l);
xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
@@ -168,8 +171,9 @@ xdrmem_putlong_unaligned(xdrs, lp)
{
u_int32_t l;
- if ((xdrs->x_handy -= sizeof(int32_t)) < 0)
+ if (xdrs->x_handy < sizeof(int32_t))
return (FALSE);
+ xdrs->x_handy -= sizeof(int32_t);
l = htonl((u_int32_t)*lp);
memmove(xdrs->x_private, &l, sizeof(int32_t));
xdrs->x_private = (char *)xdrs->x_private + sizeof(int32_t);
@@ -183,8 +187,9 @@ xdrmem_getbytes(xdrs, addr, len)
u_int len;
{
- if ((xdrs->x_handy -= len) < 0)
+ if (xdrs->x_handy < len)
return (FALSE);
+ xdrs->x_handy -= len;
memmove(addr, xdrs->x_private, len);
xdrs->x_private = (char *)xdrs->x_private + len;
return (TRUE);
@@ -197,8 +202,9 @@ xdrmem_putbytes(xdrs, addr, len)
u_int len;
{
- if ((xdrs->x_handy -= len) < 0)
+ if (xdrs->x_handy < len)
return (FALSE);
+ xdrs->x_handy -= len;
memmove(xdrs->x_private, addr, len);
xdrs->x_private = (char *)xdrs->x_private + len;
return (TRUE);
@@ -221,10 +227,10 @@ xdrmem_setpos(xdrs, pos)
char *newaddr = xdrs->x_base + pos;
char *lastaddr = (char *)xdrs->x_private + xdrs->x_handy;
- if ((long)newaddr > (long)lastaddr)
+ if (newaddr > lastaddr)
return (FALSE);
xdrs->x_private = newaddr;
- xdrs->x_handy = (int)((long)lastaddr - (long)newaddr);
+ xdrs->x_handy = (u_int)(lastaddr - newaddr); /* XXX sizeof(u_int) <? sizeof(ptrdiff_t) */
return (TRUE);
}
diff --git a/lib/libc/xdr/xdr_sizeof.c b/lib/libc/xdr/xdr_sizeof.c
index b487db8..20f1c3a 100644
--- a/lib/libc/xdr/xdr_sizeof.c
+++ b/lib/libc/xdr/xdr_sizeof.c
@@ -60,7 +60,7 @@ static bool_t
x_putbytes(xdrs, bp, len)
XDR *xdrs;
char *bp;
- int len;
+ u_int len;
{
xdrs->x_handy += len;
return (TRUE);
@@ -86,7 +86,7 @@ x_setpostn(xdrs, pos)
static int32_t *
x_inline(xdrs, len)
XDR *xdrs;
- long len;
+ u_int len;
{
if (len == 0) {
return (NULL);
@@ -94,7 +94,7 @@ x_inline(xdrs, len)
if (xdrs->x_op != XDR_ENCODE) {
return (NULL);
}
- if (len < (long) xdrs->x_base) {
+ if (len < (u_int)xdrs->x_base) {
/* x_private was already allocated */
xdrs->x_handy += len;
return ((int32_t *) xdrs->x_private);
OpenPOWER on IntegriCloud