- Fix buffer overwrite in GetModuleFileName(). Spotted by DPH.
See issue #5964 for more details.
svn path=/trunk/; revision=50912
&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;
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);