From 0431372bc491e9130e2cfe5d8ae5bc3ab15ff664 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Fri, 14 Apr 2017 09:32:47 +0000 Subject: [PATCH] [ACPI] - Ensure null termination of the method name passed to AcpiEvaluateObject in Bus_PDO_EvalMethod. Spotted by ReactCoder. CORE-13068 #resolve svn path=/trunk/; revision=74300 --- reactos/drivers/bus/acpi/eval.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/bus/acpi/eval.c b/reactos/drivers/bus/acpi/eval.c index afe39185cd4..7d10b486db0 100644 --- a/reactos/drivers/bus/acpi/eval.c +++ b/reactos/drivers/bus/acpi/eval.c @@ -17,6 +17,7 @@ Bus_PDO_EvalMethod(PPDO_DEVICE_DATA DeviceData, PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER *SimpleInt; ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING *SimpleStr; + CHAR MethodName[5]; if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) return STATUS_INVALID_PARAMETER; @@ -67,8 +68,12 @@ Bus_PDO_EvalMethod(PPDO_DEVICE_DATA DeviceData, return STATUS_NOT_IMPLEMENTED; } + RtlCopyMemory(MethodName, + EvalInputBuff->MethodName, + sizeof(EvalInputBuff->MethodName)); + MethodName[4] = ANSI_NULL; Status = AcpiEvaluateObject(DeviceData->AcpiHandle, - (CHAR*)EvalInputBuff->MethodName, + MethodName, &ParamList, &RetBuff);