]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
compat: Fix UB in arc4random.
authorRoy Marples <roy@marples.name>
Wed, 16 Oct 2019 13:48:01 +0000 (14:48 +0100)
committerRoy Marples <roy@marples.name>
Wed, 16 Oct 2019 13:48:01 +0000 (14:48 +0100)
compat/arc4random.c

index ab06df04492f96394fe7b0d2897e2c52d8b888d3..045e02343a7286b61135439db91e5da8dd311083 100644 (file)
@@ -90,7 +90,7 @@ arc4_getword(struct arc4_stream *as)
 {
        int val;
 
-       val = arc4_getbyte(as) << 24;
+       val = (int)((unsigned int)arc4_getbyte(as) << 24);
        val |= arc4_getbyte(as) << 16;
        val |= arc4_getbyte(as) << 8;
        val |= arc4_getbyte(as);