From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: devel@edk2.groups.io
Cc: Chasel Chiu <chasel.chiu@intel.com>,
Michael A Kubacki <michael.a.kubacki@intel.com>,
Sai Chaganty <rangasai.v.chaganty@intel.com>
Subject: [edk2-platforms] [PATCH v2] KabylakeSiliconPkg: Possible out-of-bounds memory writes
Date: Wed, 17 Jul 2019 23:48:34 -0700 [thread overview]
Message-ID: <20190718064834.18100-1-nathaniel.l.desimone@intel.com> (raw)
- Add check for the DSDT not existing.
- Fixed logic errors in loop boundary check.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Michael A Kubacki <michael.a.kubacki@intel.com>
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Co-authored-by: John Mathews <john.mathews@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
.../Library/DxeAslUpdateLib/DxeAslUpdateLib.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
index e6ab43db6d..87c6b15ed2 100644
--- a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
+++ b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
@@ -6,7 +6,7 @@
This library uses the ACPI Support protocol.
-Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -59,6 +59,7 @@ InitializeAslUpdateLib (
@param[in] Length - length of data to be overwritten
@retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_NOT_FOUND - Failed to locate AcpiTable.
**/
EFI_STATUS
UpdateNameAslCode (
@@ -72,6 +73,7 @@ UpdateNameAslCode (
UINT8 *CurrPtr;
UINT32 *Signature;
UINT8 *DsdtPointer;
+ UINT8 *EndPointer;
UINTN Handle;
UINT8 DataSize;
@@ -99,11 +101,15 @@ UpdateNameAslCode (
/// Point to the beginning of the DSDT table
///
CurrPtr = (UINT8 *) Table;
+ if (CurrPtr == NULL) {
+ return EFI_NOT_FOUND;
+ }
///
/// Loop through the ASL looking for values that we must fix up.
///
- for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
+ EndPointer = CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length;
+ for (DsdtPointer = CurrPtr; DsdtPointer < EndPointer; DsdtPointer++) {
///
/// Get a pointer to compare for signature
///
--
2.17.1.windows.2
next reply other threads:[~2019-07-18 6:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-18 6:48 Nate DeSimone [this message]
2019-07-18 13:57 ` [edk2-devel] [edk2-platforms] [PATCH v2] KabylakeSiliconPkg: Possible out-of-bounds memory writes Chiu, Chasel
2019-07-18 16:53 ` Chaganty, Rangasai V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190718064834.18100-1-nathaniel.l.desimone@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox