svn commit: trunk/busybox/editors

vda at busybox.net vda at busybox.net
Sat Oct 18 19:37:41 UTC 2008


Author: vda
Date: 2008-10-18 12:37:41 -0700 (Sat, 18 Oct 2008)
New Revision: 23715

Log:
vi: explain why reading 4 chars is unsafe



Modified:
   trunk/busybox/editors/vi.c


Changeset:
Modified: trunk/busybox/editors/vi.c
===================================================================
--- trunk/busybox/editors/vi.c	2008-10-18 19:18:51 UTC (rev 23714)
+++ trunk/busybox/editors/vi.c	2008-10-18 19:37:41 UTC (rev 23715)
@@ -2243,9 +2243,11 @@
 
 	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:




More information about the busybox-cvs mailing list