public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "Wang, Fan" <fan.wang@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Fu, Siyuan" <siyuan.fu@intel.com>, "Wu, Jiaxin" <jiaxin.wu@intel.com>
Subject: Re: [Patch] MdeModulePkg/DxeNetLib: Add array range check in NetIp6IsNetEqual().
Date: Thu, 11 Jan 2018 05:39:43 +0000	[thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A0931D34B78@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1515638323-13024-1-git-send-email-fan.wang@intel.com>

Reviewed-by: Hao Wu <hao.a.wu@intel.com>


Best Regards,
Hao Wu


> -----Original Message-----
> From: Wang, Fan
> Sent: Thursday, January 11, 2018 10:39 AM
> To: edk2-devel@lists.01.org
> Cc: Fu, Siyuan; Wu, Jiaxin; Wu, Hao A
> Subject: [Patch] MdeModulePkg/DxeNetLib: Add array range check in
> NetIp6IsNetEqual().
> 
> * The library API use array elements without any index range check, this
>   patch is to fix this issue to avoid null pointer reference.
> 
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Wang Fan <fan.wang@intel.com>
> ---
>  MdeModulePkg/Library/DxeNetLib/DxeNetLib.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> index cbce28f..34e11a8 100644
> --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> @@ -840,10 +840,14 @@ NetIp6IsNetEqual (
>    }
> 
>    if (Bit > 0) {
>      Mask = (UINT8) (0xFF << (8 - Bit));
> 
> +    ASSERT (Byte < 16);
> +    if (Byte >= 16) {
> +      return FALSE;
> +    }
>      if ((Ip1->Addr[Byte] & Mask) != (Ip2->Addr[Byte] & Mask)) {
>        return FALSE;
>      }
>    }
> 
> --
> 1.9.5.msysgit.1



  reply	other threads:[~2018-01-11  5:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11  2:38 [Patch] MdeModulePkg/DxeNetLib: Add array range check in NetIp6IsNetEqual() Wang Fan
2018-01-11  5:39 ` Wu, Hao A [this message]
2018-01-11  7:47 ` Wu, Jiaxin
2018-01-11  8:06   ` Wang, Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B80AF82E9BFB8E4FBD8C89DA810C6A0931D34B78@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox