]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib:util: Fix undefined bitshift
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 19 Apr 2023 22:44:41 +0000 (10:44 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 5 May 2023 02:54:31 +0000 (02:54 +0000)
runtime error: left shift of 65535 by 16 places cannot be represented in type 'int'

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/byteorder.h

index 26268ac93cd4ec4aab5c2facfa03e534ee3ea22a..e8664e95538e30bc40639208ec6d6cb04ea96e57 100644 (file)
@@ -138,7 +138,7 @@ it also defines lots of intermediate macros, just ignore those :-)
 
 /* now the reverse routines - these are used in nmb packets (mostly) */
 #define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
-#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
+#define IREV(x) ((SREV((uint32_t)x)<<16) | (SREV(((uint32_t)x)>>16)))
 #define BREV(x) ((IREV((uint64_t)x)<<32) | (IREV(((uint64_t)x)>>32)))
 
 /****************************************************************************