mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 02:10:07 +00:00
[NTOS:CM] Protect user memory access with SEH in NtQueryOpenSubKeys.
This commit is contained in:
parent
eb7be70007
commit
91cc1c3e4f
|
@ -1473,6 +1473,7 @@ NtQueryOpenSubKeys(IN POBJECT_ATTRIBUTES TargetKey,
|
|||
PCM_KEY_BODY KeyBody = NULL;
|
||||
HANDLE KeyHandle;
|
||||
NTSTATUS Status;
|
||||
ULONG SubKeys;
|
||||
|
||||
DPRINT("NtQueryOpenSubKeys()\n");
|
||||
|
||||
|
@ -1543,8 +1544,8 @@ NtQueryOpenSubKeys(IN POBJECT_ATTRIBUTES TargetKey,
|
|||
}
|
||||
|
||||
/* Call the internal API */
|
||||
*HandleCount = CmpEnumerateOpenSubKeys(KeyBody->KeyControlBlock,
|
||||
FALSE, FALSE);
|
||||
SubKeys = CmpEnumerateOpenSubKeys(KeyBody->KeyControlBlock,
|
||||
FALSE, FALSE);
|
||||
|
||||
/* Unlock the registry */
|
||||
CmpUnlockRegistry();
|
||||
|
@ -1552,6 +1553,17 @@ NtQueryOpenSubKeys(IN POBJECT_ATTRIBUTES TargetKey,
|
|||
/* Dereference the key object */
|
||||
ObDereferenceObject(KeyBody);
|
||||
|
||||
/* Write back the result */
|
||||
_SEH2_TRY
|
||||
{
|
||||
*HandleCount = SubKeys;
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
DPRINT("Done.\n");
|
||||
|
||||
return Status;
|
||||
|
|
Loading…
Reference in a new issue