From ec294fd7f5fc5de11ed889d6c2d701f918d1ecfb Mon Sep 17 00:00:00 2001 From: eadler Date: Tue, 4 Feb 2014 03:36:42 +0000 Subject: MFC r258779,r258780,r258787,r258822: Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this shifts into the sign bit. Instead use (1U << 31) which gets the expected result. Similar to the (1 << 31) case it is not defined to do (2 << 30). This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. --- lib/libc/xdr/xdr_rec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc/xdr/xdr_rec.c') diff --git a/lib/libc/xdr/xdr_rec.c b/lib/libc/xdr/xdr_rec.c index dc4aa18..4c94acb 100644 --- a/lib/libc/xdr/xdr_rec.c +++ b/lib/libc/xdr/xdr_rec.c @@ -106,7 +106,7 @@ static const struct xdr_ops xdrrec_ops = { * meet the needs of xdr and rpc based on tcp. */ -#define LAST_FRAG ((u_int32_t)(1 << 31)) +#define LAST_FRAG ((u_int32_t)(1U << 31)) typedef struct rec_strm { char *tcp_handle; -- cgit v1.1