From 44f4ebffed894f9dee57747da1ad177bc5e96171 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 29 Jan 2008 21:43:22 +0000 Subject: (svn r12017) -Fix: when you have more than 9 network interfaces you'll enter the wonderfull world of overflows. --- src/network/network.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/network/network.cpp b/src/network/network.cpp index b8a53feb5..bbb6bb833 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -404,6 +404,7 @@ static void NetworkFindIPs() inaddr.s_addr = htonl(ip | ~netmask); _broadcast_list[i] = inaddr.s_addr; i++; + if (i == MAX_INTERFACES) break; } if (read < 0) { break; @@ -431,6 +432,7 @@ static void NetworkFindIPs() if (ifa->ifa_broadaddr->sa_family != AF_INET) continue; _broadcast_list[i] = ((struct sockaddr_in*)ifa->ifa_broadaddr)->sin_addr.s_addr; i++; + if (i == MAX_INTERFACES) break; } freeifaddrs(ifap); @@ -470,6 +472,7 @@ static void NetworkFindIPs() _broadcast_list[i++] = ifo[j].iiAddress.AddressIn.sin_addr.s_addr | ~ifo[j].iiNetmask.AddressIn.sin_addr.s_addr; + if (i == MAX_INTERFACES) break; } #else ifconf.ifc_len = sizeof(buf); @@ -493,6 +496,7 @@ static void NetworkFindIPs() ioctl(sock, SIOCGIFBRDADDR, &r) != -1) { _broadcast_list[i++] = ((struct sockaddr_in*)&r.ifr_broadaddr)->sin_addr.s_addr; + if (i == MAX_INTERFACES) break; } } -- cgit v1.2.3-70-g09d2