Skip to content

Commit

Permalink
[CHERRY-PICK] ShellPkg/UefiShellNetwork2CommandsLib: Check array inde…
Browse files Browse the repository at this point in the history
…x before access

Moves the range check for the index into the array before attempting
to access the array element.

Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
  • Loading branch information
makubacki committed Sep 9, 2023
1 parent eacdde3 commit 776244b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ IfConfig6PrintIpAddr (

ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_INFO_COLON), gShellNetwork2HiiHandle);

while ((Ip->Addr[Index] == 0) && (Ip->Addr[Index + 1] == 0) && (Index < PREFIXMAXLEN)) {
while ((Index < PREFIXMAXLEN) && (Ip->Addr[Index] == 0) && (Ip->Addr[Index + 1] == 0)) {
Index = Index + 2;
if (Index > PREFIXMAXLEN - 2) {
break;
Expand Down

0 comments on commit 776244b

Please sign in to comment.