summaryrefslogtreecommitdiff
path: root/sunrpc/xdr_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc/xdr_mem.c')
-rw-r--r--sunrpc/xdr_mem.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sunrpc/xdr_mem.c b/sunrpc/xdr_mem.c
index 7b1261bbae..e3167de040 100644
--- a/sunrpc/xdr_mem.c
+++ b/sunrpc/xdr_mem.c
@@ -177,15 +177,13 @@ xdrmem_setpos (xdrs, pos)
{
caddr_t newaddr = xdrs->x_base + pos;
caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
- size_t handy = lastaddr - newaddr;
- if (newaddr > lastaddr
- || newaddr < xdrs->x_base
- || handy != (u_int) handy)
+ if ((long) newaddr > (long) lastaddr
+ || (UINT_MAX < LONG_MAX
+ && (long) UINT_MAX < (long) lastaddr - (long) newaddr))
return FALSE;
-
xdrs->x_private = newaddr;
- xdrs->x_handy = (u_int) handy;
+ xdrs->x_handy = (long) lastaddr - (long) newaddr;
return TRUE;
}