commit | a890f5e34887bff7616bdb4b9ee0bf98c8d2a8f0 | [log] [tgz] |
---|---|---|
author | Bram Moolenaar <Bram@vim.org> | Sun Jun 12 23:03:19 2016 +0200 |
committer | Bram Moolenaar <Bram@vim.org> | Sun Jun 12 23:03:19 2016 +0200 |
tree | 6dd19ec64d2d9516eb07c09478294ca1a6eba649 | |
parent | c95a302a4c42ec8230473cd4a5e0064d0a143aa8 [diff] [blame] |
patch 7.4.1926 Problem: Possible crash with many history items. Solution: Avoid the index going past the last item.
diff --git a/src/ex_getln.c b/src/ex_getln.c index fd47ef3..2f5793a 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c
@@ -6448,7 +6448,7 @@ 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++)