audk/ShellPkg
Jian J Wang c3492bd9bb ShellPkg/UefiShellLevel3CommandsLib: fix string over-read
In the for-loop condition of original code, the expression

  *CurrentCommand != CHAR_NULL

is put before expression

  CurrentCommand < SortedCommandList + SortedCommandListSize/sizeof(CHAR16)

When CurrentCommand walks to the end of string buffer, one more character
over the end of string buffer will be read and then stop.

To fix this issue, just move the last expression to the first one. Because
of short-circuit evaludation of and-expression, the following one

  *CurrentCommand != CHAR_NULL

will not be evaluated if the expression before it is evaludated as FALSE.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2018-01-25 10:24:21 +08:00
..
Application ShellPkg: Fix the bug that handling Ctrl-C improperly 2017-11-29 09:07:26 +08:00
DynamicCommand ShellPkg/tftp: Correct file comments header of Tftp.uni 2017-11-29 10:56:12 +08:00
Include ShellPkg: Rename gShellCurDir to gShellCurMapping 2017-08-30 11:42:41 +08:00
Library ShellPkg/UefiShellLevel3CommandsLib: fix string over-read 2018-01-25 10:24:21 +08:00
ShellPkg.dec ShellPkg/ShellPkg.dec: Change comments for PcdShellLibAutoInitialize 2017-12-02 16:40:14 +08:00
ShellPkg.dsc ShellPkg/DynamicCommand: Fix bug that cannot start in boot 2017-11-29 10:32:02 +08:00