[ACPI]
authorThomas Faber <thomas.faber@reactos.org>
Fri, 14 Apr 2017 09:32:47 +0000 (09:32 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Fri, 14 Apr 2017 09:32:47 +0000 (09:32 +0000)
- 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

index afe3918..7d10b48 100644 (file)
@@ -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);