Fix crash bug for interfaces without assigned address, thanks to PhoinixGR for reporting.

This commit is contained in:
Thilo Schulz 2008-04-21 13:34:44 +00:00
parent d77d3e0658
commit 1306d9760d

View file

@ -1194,7 +1194,13 @@ NET_GetLocalAddress
void NET_AddLocalAddress(char *ifname, struct sockaddr *addr, struct sockaddr *netmask) void NET_AddLocalAddress(char *ifname, struct sockaddr *addr, struct sockaddr *netmask)
{ {
int addrlen; int addrlen;
sa_family_t family = addr->sa_family; sa_family_t family;
// only add addresses that have all required info.
if(!addr || !netmask || !ifname)
return;
family = addr->sa_family;
if(numIP < MAX_IPS) if(numIP < MAX_IPS)
{ {