1
0
forked from aniani/vim

patch 8.0.1486: accessing invalid memory with "it"

Problem:    Accessing invalid memory with "it". (Dominique Pelle)
Solution:   Avoid going over the end of the line. (Christian Brabandt,
            closes #2532)
This commit is contained in:
Bram Moolenaar
2018-02-09 18:09:54 +01:00
parent 9e33efd152
commit 82846a00ac
3 changed files with 18 additions and 3 deletions

View File

@@ -684,11 +684,11 @@ searchit(
&& pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count
&& pos->col < MAXCOL - 2)
{
ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col;
if (*ptr == NUL)
ptr = ml_get_buf(buf, pos->lnum, FALSE);
if ((int)STRLEN(ptr) < pos->col)
start_char_len = 1;
else
start_char_len = (*mb_ptr2len)(ptr);
start_char_len = (*mb_ptr2len)(ptr + pos->col);
}
#endif
else