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 ShellPkg: Add missing header line for SFO flag in 'cls' command 2016-12-09 09:32:51 +08:00
Echo.c Revert "ShellPkg: Fix echo to support displaying special characters" 2016-08-25 13:00:42 +08:00
GetMtc.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
Help.c ShellPkg/UefiShellLevel3CommandsLib: fix string over-read 2018-01-25 10:24:21 +08:00
Pause.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
Touch.c ShellPkg/UefiShellLevel3CommandsLib: Remove unnecessary EFIAPI 2016-10-09 10:27:49 +08:00
Type.c ShellPkg/UefiShellLevel3CommandsLib: Remove unnecessary EFIAPI 2016-10-09 10:27:49 +08:00
UefiShellLevel3CommandsLib.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
UefiShellLevel3CommandsLib.h ShellPkg: Update sources to include MdePkg protocol definitions 2016-10-19 10:26:16 +08:00
UefiShellLevel3CommandsLib.inf ShellPkg: use UEFI_APPLICATION module type for Shell components 2015-08-25 14:54:36 +00:00
UefiShellLevel3CommandsLib.uni Shell/alias: Print detailed error when deleting alias 2017-06-10 10:23:18 +08:00
Ver.c ShellPkg: handle '-t or -terse' and '-s' flags for 'ver' command properly 2016-10-24 10:27:08 -07:00