aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-10-18 19:37:41 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-10-18 19:37:41 +0000
commite3742f4217e46f42c4f0506c23b04b84fc31e7ad (patch)
treead27f4554ff46fbdf27193aac46806e9d6a8baab
parent3ab3d8a5cfb1cfd6d2fceeea93066c4e63e5f22d (diff)
downloadbusybox-w32-e3742f4217e46f42c4f0506c23b04b84fc31e7ad.tar.gz
busybox-w32-e3742f4217e46f42c4f0506c23b04b84fc31e7ad.tar.bz2
busybox-w32-e3742f4217e46f42c4f0506c23b04b84fc31e7ad.zip
vi: explain why reading 4 chars is unsafe
-rw-r--r--editors/vi.c8
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
2243 2243
2244 n = chars_to_parse; 2244 n = chars_to_parse;
2245 if (n == 0) { 2245 if (n == 0) {
2246 // If no data, block waiting for input 2246 // If no data, block waiting for input.
2247 // (can't read more than minimal ESC sequence - 2247 // Can't read more than minimal ESC sequence size -
2248 // see "n = 0" below). 2248 // see "n = 0" below. Example of mishandled
2249 // sequence if we read 4 chars here: "ESC O A ESC O A".
2250 // We'll read "ESC O A ESC" and lose second ESC!
2249 n = safe_read(0, readbuffer, 3); 2251 n = safe_read(0, readbuffer, 3);
2250 if (n <= 0) { 2252 if (n <= 0) {
2251 error: 2253 error: