From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
"Yao, Jiewen" <jiewen.yao@intel.com>,
"Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH v2] MdePkg/BaseLib: Refine logic for (Ascii)StrnLenS to handle MaxSize = 0
Date: Tue, 14 Feb 2017 02:44:35 +0000 [thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A0931C73495@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1487040091-44960-1-git-send-email-hao.a.wu@intel.com>
This patch has the wrong version information. Please ignore this one.
Sorry for that.
Best Regards,
Hao Wu
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Hao
> Wu
> Sent: Tuesday, February 14, 2017 10:42 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A; Kinney, Michael D; Yao, Jiewen; Gao, Liming
> Subject: [edk2] [PATCH v2] MdePkg/BaseLib: Refine logic for (Ascii)StrnLenS to
> handle MaxSize = 0
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=378
>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Michael Kinney <michael.d.kinney@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
> MdePkg/Library/BaseLib/SafeString.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/MdePkg/Library/BaseLib/SafeString.c
> b/MdePkg/Library/BaseLib/SafeString.c
> index 315059e..79c79e0 100644
> --- a/MdePkg/Library/BaseLib/SafeString.c
> +++ b/MdePkg/Library/BaseLib/SafeString.c
> @@ -128,9 +128,9 @@ StrnLenS (
> ASSERT (((UINTN) String & BIT0) == 0);
>
> //
> - // If String is a null pointer, then the StrnLenS function returns zero.
> + // If String is a null pointer or MaxSize is 0, then the StrnLenS function
> returns zero.
> //
> - if (String == NULL) {
> + if ((String == NULL) || (MaxSize == 0)) {
> return 0;
> }
>
> @@ -1097,9 +1097,9 @@ AsciiStrnLenS (
> UINTN Length;
>
> //
> - // If String is a null pointer, then the AsciiStrnLenS function returns zero.
> + // If String is a null pointer or MaxSize is 0, then the AsciiStrnLenS function
> returns zero.
> //
> - if (String == NULL) {
> + if ((String == NULL) || (MaxSize == 0)) {
> return 0;
> }
>
> --
> 1.9.5.msysgit.0
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
prev parent reply other threads:[~2017-02-14 2:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 2:41 [PATCH v2] MdePkg/BaseLib: Refine logic for (Ascii)StrnLenS to handle MaxSize = 0 Hao Wu
2017-02-14 2:44 ` Wu, Hao A [this message]
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=B80AF82E9BFB8E4FBD8C89DA810C6A0931C73495@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