aboutsummaryrefslogtreecommitdiffstats
path: root/package/busybox/patches/480-vi_search.patch
diff options
context:
space:
mode:
authorMike Baker <mbm@openwrt.org>2008-10-29 13:46:28 +0000
committerMike Baker <mbm@openwrt.org>2008-10-29 13:46:28 +0000
commita75c1c1262b4d48854567879538843a06d0b8095 (patch)
tree885835363a74496bf1fec6327d157ff28d231f38 /package/busybox/patches/480-vi_search.patch
parent9dd37f3d129937fcc107abad09b3e9fe0129a4f6 (diff)
downloadupstream-a75c1c1262b4d48854567879538843a06d0b8095.tar.gz
upstream-a75c1c1262b4d48854567879538843a06d0b8095.tar.bz2
upstream-a75c1c1262b4d48854567879538843a06d0b8095.zip
fix a null pointer deref in vi's search
SVN-Revision: 13073
Diffstat (limited to 'package/busybox/patches/480-vi_search.patch')
-rw-r--r--package/busybox/patches/480-vi_search.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/package/busybox/patches/480-vi_search.patch b/package/busybox/patches/480-vi_search.patch
new file mode 100644
index 0000000000..d9fa821e47
--- /dev/null
+++ b/package/busybox/patches/480-vi_search.patch
@@ -0,0 +1,35 @@
+--- a/editors/vi.c
++++ b/editors/vi.c
+@@ -3313,7 +3313,7 @@
+ buf[1] = '\0';
+ q = get_input_line(buf); // get input line- use "status line"
+ if (q[0] && !q[1]) {
+- if (last_search_pattern[0])
++ if (last_search_pattern)
+ last_search_pattern[0] = c;
+ goto dc3; // if no pat re-use old pat
+ }
+@@ -3329,6 +3329,10 @@
+ if (cmdcnt-- > 1) {
+ do_cmd(c);
+ } // repeat cnt
++ if (last_search_pattern == 0) {
++ msg = "No previous regular expression";
++ goto dc2;
++ }
+ dir = BACK; // assume BACKWARD search
+ p = dot - 1;
+ if (last_search_pattern[0] == '?') {
+@@ -3348,10 +3352,8 @@
+ msg = "No previous regular expression";
+ goto dc2;
+ }
+- if (last_search_pattern[0] == '/') {
+- dir = FORWARD; // assume FORWARD search
+- p = dot + 1;
+- }
++ dir = FORWARD; // assume FORWARD search
++ p = dot + 1;
+ if (last_search_pattern[0] == '?') {
+ dir = BACK;
+ p = dot - 1;