[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) GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
{ {
BOOL ret; BOOL ret;
ret = GetComputerNameExA(ComputerNameNetBIOS, lpBuffer, lpnSize); ret = GetComputerNameExA(ComputerNameNetBIOS, lpBuffer, lpnSize);
if(!ret && GetLastError() == ERROR_MORE_DATA) if (!ret && GetLastError() == ERROR_MORE_DATA)
SetLastError(ERROR_BUFFER_OVERFLOW); SetLastError(ERROR_BUFFER_OVERFLOW);
return ret;
return ret;
} }

View file

@ -325,7 +325,7 @@ CopyFileExA(IN LPCSTR lpExistingFileName,
PUNICODE_STRING lpExistingFileNameW; PUNICODE_STRING lpExistingFileNameW;
lpExistingFileNameW = Basep8BitStringToStaticUnicodeString(lpExistingFileName); lpExistingFileNameW = Basep8BitStringToStaticUnicodeString(lpExistingFileName);
if (!lpExistingFileName) if (!lpExistingFileNameW)
{ {
return FALSE; 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. * %s%c : Nothing if DOS VDM, -w if WoW VDM, -ws if separate WoW VDM.
*/ */
_snwprintf(CommandLine, _snwprintf(CommandLine,
sizeof(CommandLine), sizeof(CommandLine) / sizeof(CommandLine[0]),
L"\"%s\\ntvdm.exe\" -i%lx %s%c", L"\"%s\\ntvdm.exe\" -i%lx %s%c",
Buffer, Buffer,
DosSeqId, DosSeqId,
@ -246,7 +246,7 @@ BaseGetVdmConfigInfo(IN LPCWSTR CommandLineReserved,
* %s%c : Nothing if DOS VDM, -w if WoW VDM, -ws if separate WoW VDM. * %s%c : Nothing if DOS VDM, -w if WoW VDM, -ws if separate WoW VDM.
*/ */
_snwprintf(CommandLine, _snwprintf(CommandLine,
sizeof(CommandLine), sizeof(CommandLine) / sizeof(CommandLine[0]),
L"\"%s\\ntvdm.exe\" %s%c", L"\"%s\\ntvdm.exe\" %s%c",
Buffer, Buffer,
(BinaryType == BINARY_TYPE_DOS) ? L" " : L"-w", (BinaryType == BINARY_TYPE_DOS) ? L" " : L"-w",