summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2023-09-06 12:39:21 -0400
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-09-08 15:02:35 +0000
commit493a375eef584be2beaaa3d418a8e7ff333c5468 (patch)
tree477b2cd170b5d328322d96e814b771509cef6156 /ShellPkg
parent60d0f5802bceab3482c6be6dfde73a2af8373f9f (diff)
downloadedk2-493a375eef584be2beaaa3d418a8e7ff333c5468.tar.gz
edk2-493a375eef584be2beaaa3d418a8e7ff333c5468.tar.bz2
edk2-493a375eef584be2beaaa3d418a8e7ff333c5468.zip
ShellPkg/UefiShellNetwork2CommandsLib: Check array index before access
Moves the range check for the index into the array before attempting any accesses using the array index. 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> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
index 7c80bba465..5cb92c485b 100644
--- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
+++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
@@ -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;