mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-27 19:25:36 +00:00
[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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user