public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Long Qin <qin.long@intel.com>
To: edk2-devel@lists.01.org
Cc: jian.j.wang@intel.com, ting.ye@intel.com, lersek@redhat.com
Subject: [PATCH v2 0/2] CryptoPkg/BaseCryptLib: Correct CRT realloc Wrapper
Date: Wed,  1 Nov 2017 16:19:25 +0800	[thread overview]
Message-ID: <20171101081927.12160-1-qin.long@intel.com> (raw)

V2 Update: Add NULL check for memory allocation failure.

There is one long-standing problem in current CRT realloc wrapper
implementation, which will cause the obvious buffer overflow issue
when re-allocating memory block.
One BZ report: https://bugzilla.tianocore.org/show_bug.cgi?id=605

This patch series is to fix this buffer overflow issue by introducing
one extra header to record the memory buffer size information.
And extra comments were also added to clarify the memory release routines
if the caller is required to free the memory block outside the function.

Long Qin (2):
  CryptoPkg/BaseCryptLib: Fix buffer overflow issue in realloc wrapper
  CryptoPkg/BaseCryptLib: Fix mismatched memory allocation/free

 CryptoPkg/Include/Library/BaseCryptLib.h           | 16 +++--
 CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Sign.c |  5 +-
 .../Library/BaseCryptLib/Pk/CryptPkcs7SignNull.c   |  3 +-
 .../Library/BaseCryptLib/Pk/CryptPkcs7Verify.c     | 15 ++--
 .../Library/BaseCryptLib/Pk/CryptPkcs7VerifyNull.c | 13 ++--
 .../BaseCryptLib/SysCall/BaseMemAllocation.c       | 83 ++++++++++++++++++++--
 6 files changed, 108 insertions(+), 27 deletions(-)

-- 
2.14.1.windows.1



             reply	other threads:[~2017-11-01  8:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01  8:19 Long Qin [this message]
2017-11-01  8:19 ` [PATCH v2 1/2] CryptoPkg/BaseCryptLib: Fix buffer overflow issue in realloc wrapper Long Qin
2017-11-01  8:48   ` Wang, Jian J
2017-11-01  8:19 ` [PATCH v2 2/2] CryptoPkg/BaseCryptLib: Fix mismatched memory allocation/free Long Qin

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=20171101081927.12160-1-qin.long@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