public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/2] CryptoPkg/BaseCryptLib: Correct CRT realloc Wrapper
@ 2017-11-01  8:19 Long Qin
  2017-11-01  8:19 ` [PATCH v2 1/2] CryptoPkg/BaseCryptLib: Fix buffer overflow issue in realloc wrapper Long Qin
  2017-11-01  8:19 ` [PATCH v2 2/2] CryptoPkg/BaseCryptLib: Fix mismatched memory allocation/free Long Qin
  0 siblings, 2 replies; 4+ messages in thread
From: Long Qin @ 2017-11-01  8:19 UTC (permalink / raw)
  To: edk2-devel; +Cc: jian.j.wang, ting.ye, lersek

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-01  8:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-01  8:19 [PATCH v2 0/2] CryptoPkg/BaseCryptLib: Correct CRT realloc Wrapper Long Qin
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox