[BusyBox] vi applet crash fix
Aaron Lehmann
aaronl at vitelus.com
Wed Apr 11 01:14:17 UTC 2001
Hi,
BusyBox rules :). I was quite excited to see the new vi applet. When I
was trying it out I made a typo, forgetting the trailing slash on an
:s expression. It crashed... so I fixed it :).
Index: vi.c
===================================================================
RCS file: /var/cvs/busybox/vi.c,v
retrieving revision 1.3
diff -u -r1.3 vi.c
--- vi.c 2001/04/04 19:33:32 1.3
+++ vi.c 2001/04/11 01:13:08
@@ -1940,8 +1940,10 @@
c = orig_buf[1]; // what is the delimiter
F = orig_buf + 2; // start of "find"
R = (Byte *) strchr((char *) F, c); // middle delimiter
+ if (!R) goto colon_s_fail;
*R++ = '\0'; // terminate "find"
buf1 = (Byte *) strchr((char *) R, c);
+ if (!buf1) goto colon_s_fail;
*buf1++ = '\0'; // terminate "replace"
if (*buf1 == 'g') { // :s/foo/bar/g
buf1++;
@@ -2031,6 +2033,11 @@
vc1:
dot = bound_dot(dot); // make sure "dot" is valid
return;
+#ifdef BB_FEATURE_VI_SEARCH
+colon_s_fail:
+ psb(":s expression missing delimiters");
+ return;
+#endif
}
static void Hit_Return(void)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20010410/7fa866fa/attachment.pgp
More information about the busybox
mailing list