public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jian J Wang <jian.j.wang@intel.com>
To: edk2-devel@lists.01.org
Subject: [PATCH v2 0/3] Fix misuses of AllocateCopyPool
Date: Tue,  7 Nov 2017 13:10:55 +0800	[thread overview]
Message-ID: <20171107051058.17640-1-jian.j.wang@intel.com> (raw)

> v2:
> a. Use ReallocatePool instead of allocating then copying wherever applicable

AllocateCopyPool(AllocationSize, *Buffer) will copy "AllocationSize" bytes of
memory from old "Buffer" to new allocated one. If "AllocationSize" is bigger
than size of "Buffer", heap memory overflow occurs during copy.

One solution is to allocate pool first then copy the necessary bytes to new
memory. Another is using ReallocatePool instead if old buffer will be freed
on spot.

Jian J Wang (3):
  MdeModulePkg: Fix misuses of AllocateCopyPool
  ShellPkg: Fix misuses of AllocateCopyPool
  IntelFrameworkModulePkg: Fix misuses of AllocateCopyPool

 .../Universal/BdsDxe/DeviceMngr/DeviceManager.c              | 10 +++++-----
 .../Application/UiApp/FrontPageCustomizedUiSupport.c         |  9 ++++++---
 .../BootMaintenanceManagerCustomizedUiSupport.c              |  9 ++++++---
 MdeModulePkg/Library/DeviceManagerUiLib/DeviceManager.c      | 10 +++++-----
 MdeModulePkg/Library/UefiHiiLib/HiiLib.c                     | 12 ++++++++----
 .../Universal/FvSimpleFileSystemDxe/FvSimpleFileSystem.c     |  3 ++-
 MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c |  9 ++++++---
 ShellPkg/Application/Shell/Shell.c                           |  4 +++-
 .../UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.c        |  7 +++++--
 9 files changed, 46 insertions(+), 27 deletions(-)

-- 
2.14.1.windows.1



             reply	other threads:[~2017-11-07  5:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07  5:10 Jian J Wang [this message]
2017-11-07  5:10 ` [PATCH v2 1/3] MdeModulePkg: Fix misuses of AllocateCopyPool Jian J Wang
2017-11-07  5:10 ` [PATCH v2 2/3] ShellPkg: " Jian J Wang
2017-11-07  5:35   ` Ni, Ruiyu
2017-11-07  5:10 ` [PATCH v2 3/3] IntelFrameworkModulePkg: " Jian J Wang

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=20171107051058.17640-1-jian.j.wang@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