mirror of https://github.com/acidanthera/audk.git
ShellPkg/Shell: Avoid reading content beyond string boundary
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=690 Within function EfiShellGetDevicePathFromFilePath(), when the input parameter 'Path' string is like: "FS0:" It is possible for the below statement: "if (*(Path+StrLen(MapName)+1) == CHAR_NULL) {" to read the content 1 byte beyond the string boundary (both 'Path' and 'MapName' will be FS0: in this case). This commit adds additional checks to avoid this. Cc: Steven Shi <steven.shi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
parent
14dde9e903
commit
8c3e4688e0
|
@ -598,7 +598,8 @@ EfiShellGetDevicePathFromFilePath(
|
|||
//
|
||||
// build the full device path
|
||||
//
|
||||
if (*(Path+StrLen(MapName)+1) == CHAR_NULL) {
|
||||
if ((*(Path+StrLen(MapName)) != CHAR_NULL) &&
|
||||
(*(Path+StrLen(MapName)+1) == CHAR_NULL)) {
|
||||
DevicePathForReturn = FileDevicePath(Handle, L"\\");
|
||||
} else {
|
||||
DevicePathForReturn = FileDevicePath(Handle, Path+StrLen(MapName));
|
||||
|
|
Loading…
Reference in New Issue