]> git.proxmox.com Git - mirror_edk2.git/commit - ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c
ShellPkg/hexedit: Fix a read-after-free bug
authorRuiyu Ni <ruiyu.ni@intel.com>
Wed, 7 Feb 2018 16:05:10 +0000 (00:05 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Fri, 9 Feb 2018 04:24:54 +0000 (12:24 +0800)
commit1efda6414f90c515e4ba1a8f996282f2bd322fea
tree8266883a95197a381621937936e2ad53cf30b4d5
parentad6040ec9b5bbc462762331f9738b8e42c0b9c80
ShellPkg/hexedit: Fix a read-after-free bug

HDiskImageSetDiskNameOffsetSize() and HFileImageSetFileName()
may be called using the current disk name or file name.
When this happens, today's implementation firstly frees the memory
and then accesses the just-freed memory.
The patch fixes this issue by doing nothing when the disk or file
name is the current one.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c
ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c