mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
60d0f5802b
commit
493a375eef
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue