mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/Ps2Mouse: Fix potential buffer overflow issue.
Count is initially 1 but is assigned to 2 in case PS2_READ_DATA_BYTE. Though the state machine doesn't go back from PS2_READ_DATA_BYTE to PS2_READ_BYTE_ONE (not a true bug), force assign Count to 1 to avoid potential buffer overflow issue. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
This commit is contained in:
parent
8d878f84d2
commit
aab04141dc
|
@ -343,7 +343,6 @@ PS2MouseGetPacket (
|
|||
BOOLEAN RButton;
|
||||
|
||||
KeyboardEnable = FALSE;
|
||||
Count = 1;
|
||||
State = PS2_READ_BYTE_ONE;
|
||||
|
||||
//
|
||||
|
@ -357,6 +356,7 @@ PS2MouseGetPacket (
|
|||
// Read mouse first byte data, if failed, immediately return
|
||||
//
|
||||
KbcDisableAux ();
|
||||
Count = 1;
|
||||
Status = PS2MouseRead (&Data, &Count, State);
|
||||
if (EFI_ERROR (Status)) {
|
||||
KbcEnableAux ();
|
||||
|
|
Loading…
Reference in New Issue