Author: pschweitzer Date: Sun Apr 6 14:24:00 2014 New Revision: 62657
URL: http://svn.reactos.org/svn/reactos?rev=62657&view=rev Log: [KERNEL32] - Fix buffer overrun - Fix incorrect return check
CID #514675 CID #716130 CID #731615
Modified: trunk/reactos/dll/win32/kernel32/client/compname.c trunk/reactos/dll/win32/kernel32/client/file/copy.c trunk/reactos/dll/win32/kernel32/client/vdm.c
Modified: trunk/reactos/dll/win32/kernel32/client/compname.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/c... ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/compname.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/compname.c [iso-8859-1] Sun Apr 6 14:24:00 2014 @@ -301,10 +301,12 @@ 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; }
Modified: trunk/reactos/dll/win32/kernel32/client/file/copy.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/f... ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/copy.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/copy.c [iso-8859-1] Sun Apr 6 14:24:00 2014 @@ -325,7 +325,7 @@ PUNICODE_STRING lpExistingFileNameW;
lpExistingFileNameW = Basep8BitStringToStaticUnicodeString(lpExistingFileName); - if (!lpExistingFileName) + if (!lpExistingFileNameW) { return FALSE; }
Modified: trunk/reactos/dll/win32/kernel32/client/vdm.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/v... ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/vdm.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/vdm.c [iso-8859-1] Sun Apr 6 14:24:00 2014 @@ -232,7 +232,7 @@ * %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 @@ * %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",