Back out "Feature flag to prevent executing off buffered keys"

e697add5b5 (Feature flag to prevent executing off buffered keys, 2025-01-02)
breaks my expectations/habits, and it breaks Midnight Commander.
Additionally, I'm not aware of any case where it actually adds security.
We generally assume that terminal echoback sequences do not contain
control characters except for well-known escape sequences.

This backs out commit e697add5b5.

See #10987, #10991
This commit is contained in:
Johannes Altmanninger
2025-02-09 15:52:29 +01:00
parent d418d7638a
commit 4b20e3ad91
7 changed files with 4 additions and 44 deletions

View File

@@ -296,8 +296,6 @@ pub fn from_check_exit() -> CharEvent {
const WAIT_ON_SEQUENCE_KEY_INFINITE: usize = usize::MAX;
static WAIT_ON_SEQUENCE_KEY_MS: AtomicUsize = AtomicUsize::new(WAIT_ON_SEQUENCE_KEY_INFINITE);
pub(crate) static READING_BUFFERED_INPUT: RelaxedAtomicBool = RelaxedAtomicBool::new(false);
/// Internal function used by readch to read one byte.
/// This calls select() on three fds: input (e.g. stdin), the ioport notifier fd (for main thread
/// requests), and the uvar notifier. This returns either the byte which was read, or one of the
@@ -340,7 +338,7 @@ fn readb(in_fd: RawFd, blocking: bool) -> ReadbResult {
}
// Here's where we call select().
let select_res = fdset.check_readable(if blocking && !READING_BUFFERED_INPUT.load() {
let select_res = fdset.check_readable(if blocking {
Timeout::Forever
} else {
Timeout::ZERO
@@ -379,8 +377,6 @@ fn readb(in_fd: RawFd, blocking: bool) -> ReadbResult {
FLOG!(reader, "Read byte", char_to_symbol(char::from(c)));
// The common path is to return a u8.
return ReadbResult::Byte(c);
} else {
READING_BUFFERED_INPUT.store(false);
}
if !blocking {
return ReadbResult::NothingToRead;