public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Li, Yi1" <yi1.li@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>,
	"Lu, Xiaoyu1" <xiaoyu1.lu@intel.com>,
	"Jiang, Guomin" <guomin.jiang@intel.com>
Subject: Re: [PATCH V2 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf()
Date: Mon, 26 Sep 2022 01:45:01 +0000	[thread overview]
Message-ID: <MW4PR11MB5872325EFA88263D329410DC8C529@MW4PR11MB5872.namprd11.prod.outlook.com> (raw)
In-Reply-To: <cf36a91a2609cd6643e19d0dde458de63092ebd4.1664121031.git.yi1.li@intel.com>

Merged https://github.com/tianocore/edk2/pull/3401

> -----Original Message-----
> From: Li, Yi1 <yi1.li@intel.com>
> Sent: Monday, September 26, 2022 8:25 AM
> To: devel@edk2.groups.io
> Cc: Li, Yi1 <yi1.li@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Wang,
> Jian J <jian.j.wang@intel.com>; Lu, Xiaoyu1 <xiaoyu1.lu@intel.com>; Jiang,
> Guomin <guomin.jiang@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH V2 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to
> BIO_snprintf()
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4075
> 
> Fake BIO_snprintf() does not actually print anything to buf,
> it should return -1 as error.
> 0 will be considered a correct return value, the consumer may think that
> the buf is valid and parse the buffer.
> please refer to bugzilla link for details.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
> Cc: Guomin Jiang <guomin.jiang@intel.com>
> 
> Signed-off-by: Yi Li <yi1.li@intel.com>
> reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
> ---
>  CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
> b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
> index c1fc33538f..b65d29485b 100644
> --- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
> +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
> @@ -494,7 +494,9 @@ BIO_snprintf (
>    ...
>    )
>  {
> -  return 0;
> +  // Because the function does not actually print anything to buf, it returns
> -1 as error.
> +  // Otherwise, the consumer may think that the buf is valid and parse the
> buffer.
> +  return -1;
>  }
> 
>  #ifdef __GNUC__
> --
> 2.31.1.windows.1


      reply	other threads:[~2022-09-26  1:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1664121031.git.yi1.li@intel.com>
2022-09-26  0:24 ` [PATCH V2 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf() yi1 li
2022-09-26  1:45   ` Yao, Jiewen [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=MW4PR11MB5872325EFA88263D329410DC8C529@MW4PR11MB5872.namprd11.prod.outlook.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