Check for a valid module before attempting to read the export
directory in LdrGetProcedureAddress.
This commit is contained in:
parent
220edd52d4
commit
4cbf118d88
@ -1181,7 +1181,9 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
|
|||||||
|
|
||||||
RtlEnterCriticalSection( &loader_section );
|
RtlEnterCriticalSection( &loader_section );
|
||||||
|
|
||||||
if ((exports = RtlImageDirectoryEntryToData( module, TRUE,
|
/* check if the module itself is invalid to return the proper error */
|
||||||
|
if (!get_modref( module )) ret = STATUS_DLL_NOT_FOUND;
|
||||||
|
else if ((exports = RtlImageDirectoryEntryToData( module, TRUE,
|
||||||
IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size )))
|
IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size )))
|
||||||
{
|
{
|
||||||
void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1 )
|
void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1 )
|
||||||
@ -1192,11 +1194,6 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
|
|||||||
ret = STATUS_SUCCESS;
|
ret = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* check if the module itself is invalid to return the proper error */
|
|
||||||
if (!get_modref( module )) ret = STATUS_DLL_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlLeaveCriticalSection( &loader_section );
|
RtlLeaveCriticalSection( &loader_section );
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user