From: Ulrich Weber Date: Mon, 5 Jan 2015 14:58:34 +0000 (+0100) Subject: firewall3: fix left shift on 64 bit systems in fw3_bitlen2netmask X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c03e20d7f594058ff223f30cf34de1b5e8210b8d;p=oweals%2Ffirewall3.git firewall3: fix left shift on 64 bit systems in fw3_bitlen2netmask otherwise 0.0.0.0/0 is set as 0.0.0.0/255.255.255.255 on x86_64 Signed-off-by: Ulrich Weber --- diff --git a/utils.c b/utils.c index 71a0f13..b2fbe02 100644 --- a/utils.c +++ b/utils.c @@ -803,7 +803,7 @@ fw3_bitlen2netmask(int family, int bits, void *mask) return false; v4 = mask; - v4->s_addr = htonl(~((1 << (32 - abs(bits))) - 1)); + v4->s_addr = bits ? htonl(~((1 << (32 - abs(bits))) - 1)) : 0; if (bits < 0) v4->s_addr = ~v4->s_addr;