aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-04-22 14:55:38 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-04-25 17:46:06 -0300
commit4f6cfce9003dc781cbc5394b4f955bee0209e21a (patch)
treee86efc246da70827144bb004100db89aae73c49e
parent3ef5cc0479c27f5f33a1fe50f8dc277b218b949b (diff)
downloadglibc-4f6cfce9003dc781cbc5394b4f955bee0209e21a.tar.xz
glibc-4f6cfce9003dc781cbc5394b4f955bee0209e21a.zip
sunrpc: Fix UB on xdr_hyper
ubsan triggers: UBSAN: Undefined behaviour in xdr.c:262:28 left shift of 18446744073709551615 by 32 cannot be represented in type 'long int' Fix by using unsigned type cast for left shift.
-rw-r--r--sunrpc/xdr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index a76094d6da..b7b139520e 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -259,7 +259,7 @@ xdr_hyper (XDR *xdrs, quad_t *llp)
{
if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
return FALSE;
- *llp = ((quad_t) t1) << 32;
+ *llp = ((u_quad_t) t1) << 32;
*llp |= (uint32_t) t2;
return TRUE;
}