Commit b970b220 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

iphlpapi: Allocate space enough to handle all the possible ipv4 addresses.

parent 7b6f8547
......@@ -654,9 +654,7 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
* precisely enough space.
*/
size = sizeof(IP_ADAPTER_INFO) * numNonLoopbackInterfaces;
if (numIPAddresses > numNonLoopbackInterfaces)
size += (numIPAddresses - numNonLoopbackInterfaces) *
sizeof(IP_ADDR_STRING);
size += numIPAddresses * sizeof(IP_ADDR_STRING);
if (!pAdapterInfo || *pOutBufLen < size) {
*pOutBufLen = size;
ret = ERROR_BUFFER_OVERFLOW;
......@@ -670,9 +668,7 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
table = getNonLoopbackInterfaceIndexTable();
if (table) {
size = sizeof(IP_ADAPTER_INFO) * table->numIndexes;
if (ipAddrTable->dwNumEntries > numNonLoopbackInterfaces)
size += (ipAddrTable->dwNumEntries - numNonLoopbackInterfaces) *
sizeof(IP_ADDR_STRING);
size += ipAddrTable->dwNumEntries * sizeof(IP_ADDR_STRING);
if (*pOutBufLen < size) {
*pOutBufLen = size;
ret = ERROR_INSUFFICIENT_BUFFER;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment