mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[LDR] Don't dereference a possible nullptr on a malformed forwarded import
This commit is contained in:
parent
97d0595bf6
commit
3e9cf62470
1 changed files with 8 additions and 2 deletions
|
@ -962,7 +962,7 @@ LdrpSnapThunk(IN PVOID ExportBase,
|
|||
PIMAGE_IMPORT_BY_NAME AddressOfData;
|
||||
PULONG NameTable;
|
||||
PUSHORT OrdinalTable;
|
||||
LPSTR ImportName = NULL;
|
||||
LPSTR ImportName = NULL, DotPosition;
|
||||
USHORT Hint;
|
||||
NTSTATUS Status;
|
||||
ULONG_PTR HardErrorParameters[3];
|
||||
|
@ -1117,8 +1117,14 @@ FailurePath:
|
|||
{
|
||||
/* Get the Import and Forwarder Names */
|
||||
ImportName = (LPSTR)Thunk->u1.Function;
|
||||
|
||||
DotPosition = strchr(ImportName, '.');
|
||||
ASSERT(DotPosition != NULL);
|
||||
if (!DotPosition)
|
||||
goto FailurePath;
|
||||
|
||||
ForwarderName.Buffer = ImportName;
|
||||
ForwarderName.Length = (USHORT)(strchr(ImportName, '.') - ImportName);
|
||||
ForwarderName.Length = (USHORT)(DotPosition - ImportName);
|
||||
ForwarderName.MaximumLength = ForwarderName.Length;
|
||||
Status = RtlAnsiStringToUnicodeString(&TempUString,
|
||||
&ForwarderName,
|
||||
|
|
Loading…
Reference in a new issue