Fix GetTempPath32 if count=0.

This commit is contained in:
Huw D M Davies 1998-12-15 18:04:58 +00:00 committed by Alexandre Julliard
parent ecc7669dfc
commit a03f064175
1 changed files with 2 additions and 2 deletions

View File

@ -138,7 +138,7 @@ UINT32 WINAPI GetTempPath32A( UINT32 count, LPSTR path )
if (!(ret = GetEnvironmentVariable32A( "TEMP", path, count )))
if (!(ret = GetCurrentDirectory32A( count, path )))
return 0;
if ((ret < count - 1) && (path[ret-1] != '\\'))
if (count && (ret < count - 1) && (path[ret-1] != '\\'))
{
path[ret++] = '\\';
path[ret] = '\0';
@ -159,7 +159,7 @@ UINT32 WINAPI GetTempPath32W( UINT32 count, LPWSTR path )
if (!(ret = GetEnvironmentVariable32W( temp, path, count )))
if (!(ret = GetCurrentDirectory32W( count, path )))
return 0;
if ((ret < count - 1) && (path[ret-1] != '\\'))
if (count && (ret < count - 1) && (path[ret-1] != '\\'))
{
path[ret++] = '\\';
path[ret] = '\0';