aboutsummaryrefslogtreecommitdiff
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, 6 insertions, 4 deletions
diff --git a/sunrpc/xdr_mem.c b/sunrpc/xdr_mem.c
index e3167de040..7b1261bbae 100644
--- a/sunrpc/xdr_mem.c
+++ b/sunrpc/xdr_mem.c
@@ -177,13 +177,15 @@ 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 ((long) newaddr > (long) lastaddr
- || (UINT_MAX < LONG_MAX
- && (long) UINT_MAX < (long) lastaddr - (long) newaddr))
+ if (newaddr > lastaddr
+ || newaddr < xdrs->x_base
+ || handy != (u_int) handy)
return FALSE;
+
xdrs->x_private = newaddr;
- xdrs->x_handy = (long) lastaddr - (long) newaddr;
+ xdrs->x_handy = (u_int) handy;
return TRUE;
}