mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-10-16 10:49:34 +00:00
base32_decode: avoid shifting into the sign bit
While this won't do harm on systems that do 2's completement, it triggers the compilers' undefined-behavior sanitizer and fixes sanitizer error such as the one below (where the 1694... will vary) and is distracting while debugging. dnssec.c:1427:12: runtime error: left shift of 1694604366 by 1 places cannot be represented in type 'int'
This commit is contained in:
1 parent
870f14108f
commit
e9f400dd37
1 file changed
+4
-1
+4
-1
@@ -1423,7 +1423,10 @@ static int base32_decode(char *in, unsigned char *out)
|
||||
oc |= 1;
|
||||
mask = mask >> 1;
|
||||
if (((++on) & 7) == 0)
|
||||
*p++ = oc;
|
||||
{
|
||||
*p++ = oc;
|
||||
oc = 0;
|
||||
}
|
||||
oc = oc << 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user