net_ifinfo: crashfix (Windows)

get correct size from GetAdaptersAddresses
This commit is contained in:
SimpleTease 2020-12-22 02:48:57 +00:00 committed by GitHub
parent 7d313647ae
commit 03c5c240a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,7 +154,7 @@ bool net_ifinfo_new(net_ifinfo_t *list)
PIP_ADAPTER_ADDRESSES adapter_addresses = NULL, aa = NULL;
PIP_ADAPTER_UNICAST_ADDRESS ua = NULL;
#ifdef _WIN32_WINNT_WINXP
DWORD size;
DWORD size = 0;
DWORD rv = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, NULL, &size);
adapter_addresses = (PIP_ADAPTER_ADDRESSES)malloc(size);