[NTOSKRNL] Fix a nullptr dereference in IopStartDevice

This commit is contained in:
Mark Jansen 2018-08-05 22:14:44 +02:00
parent 10c5bfb8fe
commit b2b1c054e4
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B

View file

@ -786,7 +786,7 @@ IopStartDevice(
{
NTSTATUS Status;
HANDLE InstanceHandle = NULL, ControlHandle = NULL;
UNICODE_STRING KeyName;
UNICODE_STRING KeyName, ValueString;
OBJECT_ATTRIBUTES ObjectAttributes;
if (DeviceNode->Flags & DNF_DISABLED)
@ -817,7 +817,10 @@ IopStartDevice(
goto ByeBye;
RtlInitUnicodeString(&KeyName, L"ActiveService");
Status = ZwSetValueKey(ControlHandle, &KeyName, 0, REG_SZ, DeviceNode->ServiceName.Buffer, DeviceNode->ServiceName.Length + sizeof(UNICODE_NULL));
ValueString = DeviceNode->ServiceName;
if (!ValueString.Buffer)
RtlInitUnicodeString(&ValueString, L"");
Status = ZwSetValueKey(ControlHandle, &KeyName, 0, REG_SZ, ValueString.Buffer, ValueString.Length + sizeof(UNICODE_NULL));
// }
ByeBye: