[KERNEL32]

- Fix buffer overrun
- Fix incorrect return check

CID #514675
CID #716130
CID #731615

svn path=/trunk/; revision=62657
This commit is contained in:
Pierre Schweitzer 2014-04-06 14:24:00 +00:00
parent cfbaed3a33
commit c7548b6c43
3 changed files with 8 additions and 6 deletions

View file

@ -301,10 +301,12 @@ WINAPI
GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
{
BOOL ret;
ret = GetComputerNameExA(ComputerNameNetBIOS, lpBuffer, lpnSize);
if(!ret && GetLastError() == ERROR_MORE_DATA)
SetLastError(ERROR_BUFFER_OVERFLOW);
return ret;
if (!ret && GetLastError() == ERROR_MORE_DATA)
SetLastError(ERROR_BUFFER_OVERFLOW);
return ret;
}

View file

@ -325,7 +325,7 @@ CopyFileExA(IN LPCSTR lpExistingFileName,
PUNICODE_STRING lpExistingFileNameW;
lpExistingFileNameW = Basep8BitStringToStaticUnicodeString(lpExistingFileName);
if (!lpExistingFileName)
if (!lpExistingFileNameW)
{
return FALSE;
}

View file

@ -232,7 +232,7 @@ BaseGetVdmConfigInfo(IN LPCWSTR CommandLineReserved,
* %s%c : Nothing if DOS VDM, -w if WoW VDM, -ws if separate WoW VDM.
*/
_snwprintf(CommandLine,
sizeof(CommandLine),
sizeof(CommandLine) / sizeof(CommandLine[0]),
L"\"%s\\ntvdm.exe\" -i%lx %s%c",
Buffer,
DosSeqId,
@ -246,7 +246,7 @@ BaseGetVdmConfigInfo(IN LPCWSTR CommandLineReserved,
* %s%c : Nothing if DOS VDM, -w if WoW VDM, -ws if separate WoW VDM.
*/
_snwprintf(CommandLine,
sizeof(CommandLine),
sizeof(CommandLine) / sizeof(CommandLine[0]),
L"\"%s\\ntvdm.exe\" %s%c",
Buffer,
(BinaryType == BINARY_TYPE_DOS) ? L" " : L"-w",