summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-13 18:45:25 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-13 18:49:16 -0700
commit35831b86d10dfbe7af05040fae1fa4a6181ebfc0 (patch)
treee66a684299eb9b2b5a4ef41ed82c3743c3bff1b9
parentfe87eb4099416be52b0fc9a0a1e8a52b65dfa23c (diff)
downloadxorg-lib-libXmu-35831b86d10dfbe7af05040fae1fa4a6181ebfc0.tar.gz
_XEditResGet32: Fix casts to avoid unexpected sign extension in 64-bit
Like _XEditResGet16 we need to cast to our destination type, not the source type, before combining the upper & lower halves. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/EditresCom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/EditresCom.c b/src/EditresCom.c
index 531384f..29103d9 100644
--- a/src/EditresCom.c
+++ b/src/EditresCom.c
@@ -1884,7 +1884,7 @@ _XEditResGet32(ProtocolStream *stream, unsigned long *value)
if (!(_XEditResGet16(stream, &temp1) && _XEditResGet16(stream, &temp2)))
return (False);
- *value = ((unsigned short)temp1 << (XER_NBBY * 2)) + (unsigned short)temp2;
+ *value = ((unsigned long)temp1 << (XER_NBBY * 2)) + (unsigned long)temp2;
return (True);
}