]> git.proxmox.com Git - mirror_edk2.git/commit
ShellPkg: acpiview: DBG2: Prevent buffer overruns
authorKrzysztof Koch <krzysztof.koch@arm.com>
Thu, 1 Aug 2019 23:44:02 +0000 (16:44 -0700)
committerJaben Carsey <jaben.carsey@intel.com>
Mon, 12 Aug 2019 17:13:41 +0000 (10:13 -0700)
commitffb18f7710af7e1aba192ac226528e28a4011bdb
treeb0d93b36f19ef681628e173396e7c79bd8d0dab6
parenta0792697bc54e5472e2126c6fbff8031868426a9
ShellPkg: acpiview: DBG2: Prevent buffer overruns

Modify the DBG2 table parsing logic to prevent reading past the ACPI
buffer lengths provided.

Modify the signature of the DumpDbgDeviceInfo() function to make it
consistent with the ACPI structure processing functions in other
acpiview parsers. Now, the length of the Debug Device Information
Structure is read before the entire structure is dumped.

This refactoring change makes it easier to stop reading beyond the
DBG2 table buffer if the Debug Device Information Structure Buffer
does not fit in the DBG2 buffer.

For processing the first two fields of the Debug Device Information
Structure (to get the length) a new ACPI_PARSER array is defined.

References:
- Microsoft Debug Port Table 2 (DBG2), December 10, 2015

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@inte.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c