svn commit: trunk/busybox/editors

vda at busybox.net vda at busybox.net
Sun Dec 9 04:13:47 UTC 2007


Author: vda
Date: 2007-12-08 20:13:43 -0800 (Sat, 08 Dec 2007)
New Revision: 20630

Log:
vi: don't use common_bufsiz as read buffer, it can be too small
(found by Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn at axis.com>)



Modified:
   trunk/busybox/editors/vi.c


Changeset:
Modified: trunk/busybox/editors/vi.c
===================================================================
--- trunk/busybox/editors/vi.c	2007-12-08 00:59:10 UTC (rev 20629)
+++ trunk/busybox/editors/vi.c	2007-12-09 04:13:43 UTC (rev 20630)
@@ -184,6 +184,7 @@
 #if ENABLE_FEATURE_VI_COLON
 	char *initial_cmds[3];  // currently 2 entries, NULL terminated
 #endif
+	char readbuffer[MAX_LINELEN];
 };
 #define G (*ptr_to_globals)
 #define text           (G.text          )
@@ -200,6 +201,10 @@
 #define term_orig      (G.term_orig     )
 #define term_vi        (G.term_vi       )
 #define initial_cmds   (G.initial_cmds  )
+#define readbuffer     (G.readbuffer    )
+#define INIT_G() do { \
+	PTR_TO_GLOBALS = xzalloc(sizeof(G)); \
+} while (0)
 
 static int init_text_buffer(char *); // init from file or create new
 static void edit_file(char *);	// edit one file
@@ -321,7 +326,7 @@
 	my_pid = getpid();
 #endif
 
-	PTR_TO_GLOBALS = xzalloc(sizeof(G));
+	INIT_G();
 
 #if ENABLE_FEATURE_VI_CRASHME
 	srand((long) my_pid);
@@ -2142,8 +2147,6 @@
 	return safe_poll(pfd, 1, hund*10) > 0;
 }
 
-#define readbuffer bb_common_bufsiz1
-
 static int readed_for_parse;
 
 //----- IO Routines --------------------------------------------




More information about the busybox-cvs mailing list