[KERNEL32]

- Fix buffer overwrite in GetModuleFileName(). Spotted by DPH.
See issue #5964 for more details.

svn path=/trunk/; revision=50912
This commit is contained in:
Aleksey Bragin
2011-02-26 16:50:20 +00:00
parent 2119a3b309
commit 90f36847bc
+6 -6
View File
@@ -431,10 +431,10 @@ GetModuleFileNameA (
&Module->FullDllName,
FALSE);
if (nSize < Length)
SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL);
else
if (Length < nSize)
lpFilename[Length] = '\0';
else
SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL);
RtlLeaveCriticalSection (Peb->LoaderLock);
return Length;
@@ -489,10 +489,10 @@ GetModuleFileNameW (
RtlCopyUnicodeString (&FileName,
&Module->FullDllName);
if (nSize < Length)
SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL);
else
if (Length < nSize)
lpFilename[Length] = L'\0';
else
SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL);
RtlLeaveCriticalSection (Peb->LoaderLock);