network: Fix underflow in for loop when generating bitmask
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Jan 2018 15:16:15 +0000 (15:16 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Jan 2018 15:16:15 +0000 (15:16 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/network.c

index 592ec73..4f29714 100644 (file)
@@ -59,7 +59,7 @@ static struct in6_addr prefix_to_bitmask(unsigned int prefix) {
        for (unsigned int i = 0; i < 16; i++)
                bitmask.s6_addr[i] = 0;
 
-       for (unsigned int i = prefix, j = 0; i > 0; i -= 8, j++) {
+       for (int i = prefix, j = 0; i > 0; i -= 8, j++) {
                if (i >= 8)
                        bitmask.s6_addr[j] = 0xff;
                else