From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 30F8B941BEF for ; Wed, 6 Sep 2023 17:40:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=4bZ47qZkOpPVo2i8GyxeMlbHC5SqV6O5ffUCQoUp52I=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1694022053; v=1; b=KBc5xM5c8XBQ+QDqPNVTqtaPdBQxFaSN1Dk7+RB/0sgPbN6DRoOO3K0kmSN3I7NRRfxyDHr0 LtRYfOc7x9xHUv19/tREPn0wONWW9dJmiTWdGVOimz8woSzUtpW4332f0v+f8/cBPZi4IyW3kzN 098VBMzkpxKXGCAo419IA8hM= X-Received: by 127.0.0.2 with SMTP id 88LuYY7687511xRXkqAYqSRX; Wed, 06 Sep 2023 10:40:53 -0700 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.5355.1694022053467849965 for ; Wed, 06 Sep 2023 10:40:53 -0700 X-Received: from localhost.localdomain (unknown [47.201.241.95]) by linux.microsoft.com (Postfix) with ESMTPSA id 7E8C2212B195; Wed, 6 Sep 2023 10:40:52 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7E8C2212B195 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Zhichao Gao , Michael D Kinney Subject: [edk2-devel] [PATCH v1 1/1] ShellPkg/UefiShellNetwork2CommandsLib: Check array index before access Date: Wed, 6 Sep 2023 13:40:33 -0400 Message-ID: <20230906174033.1878-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mikuback@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: IfzfseMJgsuERmdMPbgJGDyCx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=KBc5xM5c; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.microsoft.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Michael Kubacki Moves the range check for the index into the array before attempting any accesses using the array index. Cc: Zhichao Gao Cc: Michael D Kinney Signed-off-by: Michael Kubacki --- ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c b/= ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c index 7c80bba46581..5cb92c485b47 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c @@ -382,7 +382,7 @@ IfConfig6PrintIpAddr ( =20 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_CO= LON), gShellNetwork2HiiHandle); =20 - while ((Ip->Addr[Index] =3D=3D 0) && (Ip->Addr[Index + 1] =3D=3D 0= ) && (Index < PREFIXMAXLEN)) { + while ((Index < PREFIXMAXLEN) && (Ip->Addr[Index] =3D=3D 0) && (Ip= ->Addr[Index + 1] =3D=3D 0)) { Index =3D Index + 2; if (Index > PREFIXMAXLEN - 2) { break; --=20 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108336): https://edk2.groups.io/g/devel/message/108336 Mute This Topic: https://groups.io/mt/101198333/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-