summaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-13 00:48:09 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-13 00:48:09 +0000
commitddb00545b7fb84138a14a511def4526ac2bc0709 (patch)
tree61b03801e85d3508f6330f1718c1b950279d2037 /editors/vi.c
parent4819c3d477e83b846649220fc96534c9bb93d642 (diff)
downloadbusybox-w32-ddb00545b7fb84138a14a511def4526ac2bc0709.tar.gz
busybox-w32-ddb00545b7fb84138a14a511def4526ac2bc0709.tar.bz2
busybox-w32-ddb00545b7fb84138a14a511def4526ac2bc0709.zip
A patch from Aaron Lehmann <aaronl@vitelus.com> to fix a
crash on a broken regexp.
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 5a68ba9f1..6d1502966 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21char *vi_Version = 21char *vi_Version =
22 "$Id: vi.c,v 1.7 2001/05/07 22:57:47 andersen Exp $"; 22 "$Id: vi.c,v 1.8 2001/05/13 00:48:09 andersen Exp $";
23 23
24/* 24/*
25 * To compile for standalone use: 25 * To compile for standalone use:
@@ -2076,8 +2076,10 @@ static void colon(Byte * buf)
2076 c = orig_buf[1]; // what is the delimiter 2076 c = orig_buf[1]; // what is the delimiter
2077 F = orig_buf + 2; // start of "find" 2077 F = orig_buf + 2; // start of "find"
2078 R = (Byte *) strchr((char *) F, c); // middle delimiter 2078 R = (Byte *) strchr((char *) F, c); // middle delimiter
2079 if (!R) goto colon_s_fail;
2079 *R++ = '\0'; // terminate "find" 2080 *R++ = '\0'; // terminate "find"
2080 buf1 = (Byte *) strchr((char *) R, c); 2081 buf1 = (Byte *) strchr((char *) R, c);
2082 if (!buf1) goto colon_s_fail;
2081 *buf1++ = '\0'; // terminate "replace" 2083 *buf1++ = '\0'; // terminate "replace"
2082 if (*buf1 == 'g') { // :s/foo/bar/g 2084 if (*buf1 == 'g') { // :s/foo/bar/g
2083 buf1++; 2085 buf1++;
@@ -2168,6 +2170,12 @@ static void colon(Byte * buf)
2168 vc1: 2170 vc1:
2169 dot = bound_dot(dot); // make sure "dot" is valid 2171 dot = bound_dot(dot); // make sure "dot" is valid
2170 return; 2172 return;
2173#ifdef BB_FEATURE_VI_SEARCH
2174colon_s_fail:
2175 psb(":s expression missing delimiters");
2176 return;
2177#endif
2178
2171} 2179}
2172 2180
2173static void Hit_Return(void) 2181static void Hit_Return(void)