← Commit list

e3742f421

Denis Vlasenko
Denis Vlasenko
2008-10-18
FAILED Duration: 35s

Subject

vi: explain why reading 4 chars is unsafe

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

editors/vi.c+5 -3
@@ -2243,9 +2243,11 @@ static char readit(void) // read (maybe cursor) key from stdin
n = chars_to_parse;
if (n == 0) {
- // If no data, block waiting for input
- // (can't read more than minimal ESC sequence -
- // see "n = 0" below).
+ // If no data, block waiting for input.
+ // Can't read more than minimal ESC sequence size -
+ // see "n = 0" below. Example of mishandled
+ // sequence if we read 4 chars here: "ESC O A ESC O A".
+ // We'll read "ESC O A ESC" and lose second ESC!
n = safe_read(0, readbuffer, 3);
if (n <= 0) {
error: