aboutsummaryrefslogtreecommitdiff
path: root/lib/curl_endian.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2015-01-02 15:53:42 +0000
committerSteve Holme <steve_holme@hotmail.com>2015-01-02 15:53:42 +0000
commita75ede4b9b525bcb9c523de8d9bd0abeb1302bc8 (patch)
tree37441a97c96c65ebf0ea9d05c6c90816c56cb045 /lib/curl_endian.c
parenta3daf542adb63dbf7632fab0166ec26cb231b1c1 (diff)
endian: Fixed bit-shift in 64-bit integer read functions
From commit 43792592ca and 4bb5a351b2. Reported-by: Michael Osipov
Diffstat (limited to 'lib/curl_endian.c')
-rw-r--r--lib/curl_endian.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/curl_endian.c b/lib/curl_endian.c
index 5d6119677..14a28834d 100644
--- a/lib/curl_endian.c
+++ b/lib/curl_endian.c
@@ -85,7 +85,7 @@ unsigned long long Curl_read64_le(unsigned char *buf)
((unsigned long long)buf[4] << 32) |
((unsigned long long)buf[5] << 40) |
((unsigned long long)buf[6] << 48) |
- ((unsigned long long)buf[7] << 54);
+ ((unsigned long long)buf[7] << 56);
}
#else
unsigned __int64 Curl_read64_le(unsigned char *buf)
@@ -93,7 +93,7 @@ unsigned __int64 Curl_read64_le(unsigned char *buf)
return ((unsigned __int64)buf[0]) | ((unsigned __int64)buf[1] << 8) |
((unsigned __int64)buf[2] << 16) | ((unsigned __int64)buf[3] << 24) |
((unsigned __int64)buf[4] << 32) | ((unsigned __int64)buf[5] << 40) |
- ((unsigned __int64)buf[6] << 48) | ((unsigned __int64)buf[7] << 54);
+ ((unsigned __int64)buf[6] << 48) | ((unsigned __int64)buf[7] << 56);
}
#endif
@@ -151,7 +151,7 @@ unsigned int Curl_read32_be(unsigned char *buf)
#if defined(HAVE_LONGLONG)
unsigned long long Curl_read64_be(unsigned char *buf)
{
- return ((unsigned long long)buf[0] << 54) |
+ return ((unsigned long long)buf[0] << 56) |
((unsigned long long)buf[1] << 48) |
((unsigned long long)buf[2] << 40) |
((unsigned long long)buf[3] << 32) |
@@ -163,7 +163,7 @@ unsigned long long Curl_read64_be(unsigned char *buf)
#else
unsigned __int64 Curl_read64_be(unsigned char *buf)
{
- return ((unsigned __int64)buf[0] << 54) | ((unsigned __int64)buf[1] << 48) |
+ return ((unsigned __int64)buf[0] << 56) | ((unsigned __int64)buf[1] << 48) |
((unsigned __int64)buf[2] << 40) | ((unsigned __int64)buf[3] << 32) |
((unsigned __int64)buf[4] << 24) | ((unsigned __int64)buf[5] << 16) |
((unsigned __int64)buf[6] << 8) | ((unsigned __int64)buf[7]);