]> git.proxmox.com Git - mirror_edk2.git/commit
Shellpkg/editor: Fix a bug that may modifies Line[-1]
authorRuiyu Ni <ruiyu.ni@intel.com>
Wed, 25 Oct 2017 01:01:27 +0000 (09:01 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Thu, 26 Oct 2017 05:04:15 +0000 (13:04 +0800)
commit452676ffd895651683dcf19535e65294ff1d00d0
treee17cf401518006a6830b028e24cf9ea7fc71d332
parent704b71d7e11f115a3b5b03471d6420a7a70f1585
Shellpkg/editor: Fix a bug that may modifies Line[-1]

The original code as below intend to set the character
before last column to CHAR_NULL.
  Line[(LastCol % (ARRAY_SIZE (Line) - 1)) - 1] = CHAR_NULL;

But when LastCol % (ARRAY_SIZE (Line) - 1)) equals to 0,
Line[-1] is modified.

We should change to code as below:
  Line[(LastCol - 1) % (ARRAY_SIZE (Line) - 1)] = CHAR_NULL;

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c