diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/search.c | 8 | ||||
-rw-r--r-- | src/nvim/testdir/test_search.vim | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 1eb1a25a19..0a266382ec 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1382,13 +1382,13 @@ int searchc(cmdarg_T *cap, int t_cmd) col -= (*mb_head_off)(p, p + col - 1) + 1; } if (lastc_bytelen == 1) { - if (p[col] == c && stop) + if (p[col] == c && stop) { break; - } else { - if (memcmp(p + col, lastc_bytes, lastc_bytelen) == 0 && stop) + } + } else if (STRNCMP(p + col, lastc_bytes, lastc_bytelen) == 0 && stop) { break; } - stop = TRUE; + stop = true; } } else { for (;; ) { diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim index a333e7f206..03112df46f 100644 --- a/src/nvim/testdir/test_search.vim +++ b/src/nvim/testdir/test_search.vim @@ -298,3 +298,10 @@ func Test_searchpair() q! endfunc +func Test_searchc() + " These commands used to cause memory overflow in searchc(). + new + norm ixx + exe "norm 0t\u93cf" + bw! +endfunc |