aboutsummaryrefslogtreecommitdiff
path: root/vi.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-13 00:48:09 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-13 00:48:09 +0000
commit6f944e61184e61923bd3986798056304a9dace76 (patch)
tree61b03801e85d3508f6330f1718c1b950279d2037 /vi.c
parent27d63561b175b35a60e9ddb1ae3ab42b1d009a84 (diff)
downloadbusybox-w32-6f944e61184e61923bd3986798056304a9dace76.tar.gz
busybox-w32-6f944e61184e61923bd3986798056304a9dace76.tar.bz2
busybox-w32-6f944e61184e61923bd3986798056304a9dace76.zip
A patch from Aaron Lehmann <aaronl@vitelus.com> to fix a
crash on a broken regexp. git-svn-id: svn://busybox.net/trunk/busybox@2630 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'vi.c')
-rw-r--r--vi.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/vi.c b/vi.c
index 5a68ba9f1..6d1502966 100644
--- a/vi.c
+++ b/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)