From 35831b86d10dfbe7af05040fae1fa4a6181ebfc0 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 13 Sep 2022 18:45:25 -0700 Subject: _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 --- src/EditresCom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } -- cgit v1.2.1