public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Fix misuses of AllocateCopyPool
@ 2017-11-08  2:11 Jian J Wang
  2017-11-08  2:11 ` [PATCH v3 1/3] MdeModulePkg: " Jian J Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jian J Wang @ 2017-11-08  2:11 UTC (permalink / raw)
  To: edk2-devel

> v3:
> a. Add necessary ASSERT
> b. Correct StrCpyS parameter
> c. Coding style clean-up

> 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         |  8 ++++++--
 .../BootMaintenanceManagerCustomizedUiSupport.c              |  8 ++++++--
 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(+), 25 deletions(-)

-- 
2.14.1.windows.1



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

end of thread, other threads:[~2017-11-09  0:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-08  2:11 [PATCH v3 0/3] Fix misuses of AllocateCopyPool Jian J Wang
2017-11-08  2:11 ` [PATCH v3 1/3] MdeModulePkg: " Jian J Wang
2017-11-08  2:37   ` Zeng, Star
2017-11-08  2:46     ` Wang, Jian J
2017-11-08  2:57       ` Zeng, Star
2017-11-08  2:12 ` [PATCH v3 2/3] ShellPkg: " Jian J Wang
2017-11-08 15:50   ` Carsey, Jaben
2017-11-09  1:03     ` Wang, Jian J
2017-11-08  2:12 ` [PATCH v3 3/3] IntelFrameworkModulePkg: " Jian J Wang
2017-11-08  2:33   ` Bi, Dandan

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