GetTempPathW should write an empty string to the buffer in case it wasn't large enough

svn path=/trunk/; revision=13354
This commit is contained in:
Thomas Bluemel 2005-01-28 19:28:24 +00:00
parent 919a5257b4
commit 87e189fd31

View file

@ -308,7 +308,7 @@ GetTempPathW (
if (nBufferLength < Value->Length / sizeof(WCHAR) + 2)
Length++;
if (lpBuffer != NULL)
if (nBufferLength >= Value->Length /sizeof(WCHAR) + 1)
{
if (nBufferLength < Value->Length / sizeof(WCHAR) + 2)
{
@ -324,6 +324,9 @@ GetTempPathW (
lpBuffer[Value->Length / sizeof(WCHAR)] = L'\\';
lpBuffer[Value->Length / sizeof(WCHAR) + 1] = 0;
}
} else if (nBufferLength > 0)
{
lpBuffer[0] = L'\0';
}
return Length;