if (dot)
length = (int)(dot - hostname);
- if (*lpnSize <= (DWORD) length)
+ if ((*lpnSize <= (DWORD) length) || !lpBuffer)
{
SetLastError(ERROR_BUFFER_OVERFLOW);
*lpnSize = length + 1;
return FALSE;
}
- if (!lpBuffer)
- return FALSE;
-
CopyMemory(lpBuffer, hostname, length);
lpBuffer[length] = '\0';
*lpnSize = length;
case ComputerNamePhysicalDnsHostname:
case ComputerNamePhysicalDnsDomain:
case ComputerNamePhysicalDnsFullyQualified:
- if (*lpnSize <= (DWORD) length)
+ if ((*lpnSize <= (DWORD) length) || !lpBuffer)
{
*lpnSize = length + 1;
SetLastError(ERROR_MORE_DATA);
return FALSE;
}
- if (!lpBuffer)
- return FALSE;
-
CopyMemory(lpBuffer, hostname, length);
lpBuffer[length] = '\0';
+ *lpnSize = length;
break;
default: