From: Andreas Schneider Date: Thu, 22 Nov 2018 08:22:38 +0000 (+0100) Subject: lib:crypto: Fix undefined behavior in md4 X-Git-Tag: tdb-1.3.17~669 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee6497574a0b5a7fcaf8171fea50dd169f468158;p=thirdparty%2Fsamba.git lib:crypto: Fix undefined behavior in md4 runtime error: left shift of 145 by 24 places cannot be represented in type 'int' Signed-off-by: Andreas Schneider Reviewed-by: Gary Lockyer --- diff --git a/lib/crypto/md4.c b/lib/crypto/md4.c index 7eb6070cd44..831fe32ecb8 100644 --- a/lib/crypto/md4.c +++ b/lib/crypto/md4.c @@ -112,8 +112,10 @@ static void copy64(uint32_t *M, const uint8_t *in) int i; for (i=0;i<16;i++) - M[i] = (in[i*4+3]<<24) | (in[i*4+2]<<16) | - (in[i*4+1]<<8) | (in[i*4+0]<<0); + M[i] = ((uint32_t)in[i*4+3] << 24) | + ((uint32_t)in[i*4+2] << 16) | + ((uint32_t)in[i*4+1] << 8) | + ((uint32_t)in[i*4+0] << 0); } static void copy4(uint8_t *out, uint32_t x)