From a890f5e34887bff7616bdb4b9ee0bf98c8d2a8f0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 12 Jun 2016 23:03:19 +0200 Subject: patch 7.4.1926 Problem: Possible crash with many history items. Solution: Avoid the index going past the last item. --- src/ex_getln.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ex_getln.c') diff --git a/src/ex_getln.c b/src/ex_getln.c index fd47ef3df..2f5793a65 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -6448,7 +6448,7 @@ merge_history(int type) else clear_hist_entry(&new_hist[i]); } - hisidx[type] = len - 1; + hisidx[type] = (i < len ? i : len) - 1; /* Free what is not kept. */ for (i = 0; i < viminfo_hisidx[type]; i++) -- cgit v1.2.3