getifaddrs: Fix buffer overrun with >3 interfaces.

This commit is contained in:
Justin Maggard 2015-07-30 16:25:48 -07:00
parent c29a9cf52b
commit e7ec55a2ad
2 changed files with 3 additions and 1 deletions

View File

@ -322,7 +322,7 @@ reload_ifaces(int force_notify)
do { do {
getifaddr(runtime_vars.ifaces[i]); getifaddr(runtime_vars.ifaces[i]);
i++; i++;
} while (runtime_vars.ifaces[i]); } while (i < MAX_LAN_ADDR && runtime_vars.ifaces[i]);
for (i = 0; i < n_lan_addr; i++) for (i = 0; i < n_lan_addr; i++)
{ {

View File

@ -554,6 +554,8 @@ init(int argc, char **argv)
MAX_LAN_ADDR, word); MAX_LAN_ADDR, word);
break; break;
} }
while (isspace(*word))
word++;
runtime_vars.ifaces[ifaces++] = word; runtime_vars.ifaces[ifaces++] = word;
} }
break; break;