summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2019-09-06 23:29:03 +0200
committerLaszlo Ersek <lersek@redhat.com>2019-10-09 09:40:10 +0200
commitd5e35fddec9389b50b362c84eda6b47975b99fa0 (patch)
tree7acccd7048cc7e1f77d26f6e3410b221aecda3a9
parent1b3115baad7fc4f5d0f2e57bd16d7902516e185b (diff)
downloadedk2-d5e35fddec9389b50b362c84eda6b47975b99fa0.tar.gz
edk2-d5e35fddec9389b50b362c84eda6b47975b99fa0.tar.bz2
edk2-d5e35fddec9389b50b362c84eda6b47975b99fa0.zip
ShellPkg/UefiShellDebug1CommandsLib: fix ShellCloseFile() call
In the FileBufferSave() function, we invoke ShellCloseFile() if "Directory Can Not Be Saved". The ShellCloseFile() function takes a (SHELL_FILE_HANDLE*) parameter called "FileHandle", and correctly passes the de-referenced (*FileHandle) to EFI_SHELL_CLOSE_FILE, which takes a SHELL_FILE_HANDLE. However, FileBufferSave() passes SHELL_FILE_HANDLE to ShellCloseFile(), not the expected (SHELL_FILE_HANDLE*). Correct it. This fixes an actual bug that has remained hidden for two reasons: - pointer-to-VOID converts from/to any pointer-to-object type silently, - the bug is on an error path which has likely never fired in practice. Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
index 464f9de38e..fd324cc4a8 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
@@ -1462,7 +1462,7 @@ FileBufferSave (
if (Info != NULL && Info->Attribute & EFI_FILE_DIRECTORY) {
StatusBarSetStatusString (L"Directory Can Not Be Saved");
- ShellCloseFile(FileHandle);
+ ShellCloseFile (&FileHandle);
FreePool(Info);
return EFI_LOAD_ERROR;
}