]> The Tcpdump Group git mirrors - libpcap/commitdiff
Fix data type of loop index.
authorGuy Harris <[email protected]>
Tue, 5 Sep 2017 21:12:52 +0000 (14:12 -0700)
committerGuy Harris <[email protected]>
Tue, 5 Sep 2017 21:12:52 +0000 (14:12 -0700)
If the loop upper bound is of type X, and the lower bound can also be a
value of type X, you probably want to use type X for the loop index
(unless you're worried about the loop index overflowing, but you're not
going to get 2^31 addresses, so that's not an issue here).

inet.c

diff --git a/inet.c b/inet.c
index bfad07a1fe9456ba03e785ca2e67bbdca148a8cc..b63d865577690713e9277a8f559a652a00125f86 100644 (file)
--- a/inet.c
+++ b/inet.c
@@ -375,7 +375,7 @@ pcap_lookupnet(device, netp, maskp, errbuf)
        npf_if_addr if_addrs[MAX_NETWORK_ADDRESSES];
        LONG if_addr_size = MAX_NETWORK_ADDRESSES;
        struct sockaddr_in *t_addr;
-       unsigned int i;
+       LONG i;
 
        if (!PacketGetNetInfoEx((void *)device, if_addrs, &if_addr_size)) {
                *netp = *maskp = 0;