audk/ShellPkg/Library/UefiShellLevel3CommandsLib
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
..
Alias.c ShellPkg/alias: Fix flag parsing logic 2017-10-20 12:54:36 +08:00
Cls.c
Echo.c
GetMtc.c
Help.c ShellPkg/UefiShellLevel3CommandsLib: fix string over-read 2018-01-25 10:24:21 +08:00
Pause.c
Touch.c
Type.c
UefiShellLevel3CommandsLib.c
UefiShellLevel3CommandsLib.h
UefiShellLevel3CommandsLib.inf
UefiShellLevel3CommandsLib.uni Shell/alias: Print detailed error when deleting alias 2017-06-10 10:23:18 +08:00
Ver.c