mirror of
https://git.openafs.org/openafs.git
synced 2025-01-20 16:00:12 +00:00
getipaddrlist-20040318
Improve error checking in GetNumOfIpAddrs to prevent potential invalid memory access if the IP Address Table cannot be accessed. (win2000 with no privs)
This commit is contained in:
parent
48913f747f
commit
e1cc03f597
@ -3449,9 +3449,11 @@ GetNumOfIpAddrs(void)
|
||||
if (code == ERROR_INSUFFICIENT_BUFFER) {
|
||||
pIpAddrTable = malloc(dwSize);
|
||||
code = GetIpAddrTable(pIpAddrTable, &dwSize, 0);
|
||||
for ( index=0; index < pIpAddrTable->dwNumEntries; index++ ) {
|
||||
if (pIpAddrTable->table[index].dwAddr != 0)
|
||||
validAddrs++;
|
||||
if ( code == NO_ERROR ) {
|
||||
for ( index=0; index < pIpAddrTable->dwNumEntries; index++ ) {
|
||||
if (pIpAddrTable->table[index].dwAddr != 0)
|
||||
validAddrs++;
|
||||
}
|
||||
}
|
||||
free(pIpAddrTable);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user