]> git.proxmox.com Git - mirror_edk2.git/commit - ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
ShellPkg/rm: fix hang when deleting an absolutely-empty directory
authorRuiyu Ni <ruiyu.ni@intel.com>
Thu, 8 Feb 2018 03:40:04 +0000 (11:40 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Fri, 9 Feb 2018 04:24:55 +0000 (12:24 +0800)
commit7506fe43a10d5f8148417812d204498995d9f1e7
tree938387761ea530f65f12ce95d57d311e3be065db
parent1efda6414f90c515e4ba1a8f996282f2bd322fea
ShellPkg/rm: fix hang when deleting an absolutely-empty directory
An ordinary empty directory should contain "." and ".." entries.
When an empty directory even doesn't contain "." or ".." entry,
FileHandleFindFirstFile() may return error status and a NULL
FileInfo.
IsDirectoryEmpty() implementation in Rm.c doesn't consider this
case and the deference of FileInfo->FileName causes page fault
exception because FileInfo is NULL.
The patch checks the return status of FileHandleFindFirstFile()
to fix this issue.

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/UefiShellLevel2CommandsLib/Rm.c