Commit 54b75f3d authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

netapi32: Avoid sizeof on structs with a varlength array.

parent f417dc1e
......@@ -407,9 +407,8 @@ static BOOL NetBTFindNameAnswerCallback(void *pVoid, WORD answerCount,
{
if (queryData->cacheEntry == NULL)
{
queryData->cacheEntry = HeapAlloc(
GetProcessHeap(), 0, sizeof(NBNameCacheEntry) +
(answerCount - 1) * sizeof(DWORD));
queryData->cacheEntry = HeapAlloc(GetProcessHeap(), 0,
FIELD_OFFSET(NBNameCacheEntry, addresses[answerCount]));
if (queryData->cacheEntry)
queryData->cacheEntry->numAddresses = 0;
else
......@@ -541,8 +540,8 @@ static UCHAR NetBTinetResolve(const UCHAR name[NCBNAMSZ],
if (addr != INADDR_NONE)
{
*cacheEntry = HeapAlloc(GetProcessHeap(),
0, sizeof(NBNameCacheEntry));
*cacheEntry = HeapAlloc(GetProcessHeap(), 0,
FIELD_OFFSET(NBNameCacheEntry, addresses[1]));
if (*cacheEntry)
{
memcpy((*cacheEntry)->name, name, NCBNAMSZ);
......@@ -566,9 +565,8 @@ static UCHAR NetBTinetResolve(const UCHAR name[NCBNAMSZ],
;
if (host->h_addr_list && host->h_addr_list[0])
{
*cacheEntry = HeapAlloc(
GetProcessHeap(), 0, sizeof(NBNameCacheEntry) +
(i - 1) * sizeof(DWORD));
*cacheEntry = HeapAlloc(GetProcessHeap(), 0,
FIELD_OFFSET(NBNameCacheEntry, addresses[i]));
if (*cacheEntry)
{
memcpy((*cacheEntry)->name, name, NCBNAMSZ);
......
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