mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
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>
This commit is contained in:
parent
704b71d7e1
commit
452676ffd8
@ -205,7 +205,7 @@ EditorClearLine (
|
||||
//
|
||||
// if CHAR_NULL is still at position LastCol, it will cause first line error
|
||||
//
|
||||
Line[(LastCol % (ARRAY_SIZE (Line) - 1)) - 1] = CHAR_NULL;
|
||||
Line[(LastCol - 1) % (ARRAY_SIZE (Line) - 1)] = CHAR_NULL;
|
||||
} else {
|
||||
Line[LastCol % (ARRAY_SIZE (Line) - 1)] = CHAR_NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user