]> git.proxmox.com Git - mirror_edk2.git/commit
MdePkg/BaseLib: Avoid reading content beyond string boundary
authorHao Wu <hao.a.wu@intel.com>
Tue, 19 Sep 2017 03:01:56 +0000 (11:01 +0800)
committerHao Wu <hao.a.wu@intel.com>
Thu, 21 Sep 2017 06:06:28 +0000 (14:06 +0800)
commit9fdf31789a7088736bc574f6802f4a97b5ef2e97
tree693bfefa2e79907fab576d561fd81a27647fea92
parent8c3e4688e0d8e6c218a98855d98976ce46dbb29e
MdePkg/BaseLib: Avoid reading content beyond string boundary

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=705

As mentioned in the above Bugzilla link by Steven, within the function
PathCleanUpDirectories(), when executing command:
"cd ."

under Shell, the input parameter 'Path' string will have string length
less than 2. Hence, it is possible for the below statement:
"if (StrCmp (Path + StrLen (Path) - 2, L"\\.") == 0) {"

to read contents before the string boundary.

This commit adds additional checks to avoid this.

Cc: Steven Shi <steven.shi@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdePkg/Library/BaseLib/FilePaths.c