diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-18 23:37:41 +0400 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-10-18 23:37:41 +0400 |
commit | e3742f4217e46f42c4f0506c23b04b84fc31e7ad (patch) | |
tree | ad27f4554ff46fbdf27193aac46806e9d6a8baab /editors | |
parent | 3ab3d8a5cfb1cfd6d2fceeea93066c4e63e5f22d (diff) |
vi: explain why reading 4 chars is unsafe
Diffstat (limited to 'editors')
-rw-r--r-- | editors/vi.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/editors/vi.c b/editors/vi.c index acbede359..8944f770a 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -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: |