Reviewed-by: Zhichao Gao <[email protected]>

Thanks,
Zhichao

> -----Original Message-----
> From: [email protected] <[email protected]>
> Sent: Thursday, September 7, 2023 1:41 AM
> To: [email protected]
> Cc: Gao, Zhichao <[email protected]>; Kinney, Michael D
> <[email protected]>
> Subject: [PATCH v1 1/1] ShellPkg/UefiShellNetwork2CommandsLib: Check
> array index before access
> 
> From: Michael Kubacki <[email protected]>
> 
> Moves the range check for the index into the array before attempting any
> accesses using the array index.
> 
> Cc: Zhichao Gao <[email protected]>
> Cc: Michael D Kinney <[email protected]>
> Signed-off-by: Michael Kubacki <[email protected]>
> ---
>  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 (
> 
>        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;
> --
> 2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108355): https://edk2.groups.io/g/devel/message/108355
Mute This Topic: https://groups.io/mt/101198333/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to