[edk2] [PATCH v3 0/3] Fix misuses of AllocateCopyPool

Jian J Wang posted 3 patches 7 years, 1 month ago
Failed in applying to current master (apply log)
.../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(-)
[edk2] [PATCH v3 0/3] Fix misuses of AllocateCopyPool
Posted by Jian J Wang 7 years, 1 month ago
> 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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel