vt: Fix incorrect buffer read size in VirtualTerminal

Resolved an issue in VirtualTerminal::Read where the size of the report buffer was incorrectly set to sizeof(report), causing multiple unintended reads.
This commit is contained in:
EnderIce2 2024-10-19 01:31:42 +03:00
parent 6657a90739
commit 88c87172ba
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -54,7 +54,7 @@ namespace KernelConsole
while (DriverManager->GlobalKeyboardInputReports.Count() == 0)
TaskManager->Yield();
DriverManager->GlobalKeyboardInputReports.Read(&report, sizeof(report));
DriverManager->GlobalKeyboardInputReports.Read(&report, 1);
int pkey = report.Key & ~KEY_PRESSED;
if (pkey == KEY_LEFT_SHIFT || pkey == KEY_RIGHT_SHIFT)
@ -75,11 +75,9 @@ namespace KernelConsole
char c = Driver::GetScanCode(report.Key, upperCase);
char *buf = (char *)Buffer;
buf[0] = c;
debug("KCON: %c", c);
if (this->TerminalConfig.c_lflag & ECHO)
{
debug("ECHO");
if (this->TerminalConfig.c_lflag & ICANON)
this->Process(buf[0]);
else
@ -95,12 +93,7 @@ namespace KernelConsole
// return bufLength;
// }
}
else
{
debug("~ICANON");
}
debug("ret 1");
return 1;
}