mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.843
Problem: Still possible to go beyond the end of a string.
Solution: Check for NUL also in second string. (Dominique Pelle)
d43f0951bc
This commit is contained in:
parent
ab8a771dbd
commit
c9898e0ec3
@ -1057,6 +1057,8 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l
|
|||||||
*/
|
*/
|
||||||
static int ff_wc_equal(char_u *s1, char_u *s2)
|
static int ff_wc_equal(char_u *s1, char_u *s2)
|
||||||
{
|
{
|
||||||
|
int c1 = NUL;
|
||||||
|
int c2 = NUL;
|
||||||
int prev1 = NUL;
|
int prev1 = NUL;
|
||||||
int prev2 = NUL;
|
int prev2 = NUL;
|
||||||
|
|
||||||
@ -1066,13 +1068,13 @@ static int ff_wc_equal(char_u *s1, char_u *s2)
|
|||||||
if (s1 == NULL || s2 == NULL)
|
if (s1 == NULL || s2 == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
for (int i = 0, j = 0; s1[i] != NUL;) {
|
for (int i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) {
|
||||||
int c1 = PTR2CHAR(s1 + i);
|
c1 = PTR2CHAR(s1 + i);
|
||||||
int c2 = PTR2CHAR(s2 + j);
|
c2 = PTR2CHAR(s2 + j);
|
||||||
|
|
||||||
if ((p_fic ? vim_tolower(c1) != vim_tolower(c2) : c1 != c2)
|
if ((p_fic ? vim_tolower(c1) != vim_tolower(c2) : c1 != c2)
|
||||||
&& (prev1 != '*' || prev2 != '*')) {
|
&& (prev1 != '*' || prev2 != '*')) {
|
||||||
return FAIL;
|
return false;
|
||||||
}
|
}
|
||||||
prev2 = prev1;
|
prev2 = prev1;
|
||||||
prev1 = c1;
|
prev1 = c1;
|
||||||
@ -1080,7 +1082,7 @@ static int ff_wc_equal(char_u *s1, char_u *s2)
|
|||||||
i += MB_PTR2LEN(s1 + i);
|
i += MB_PTR2LEN(s1 + i);
|
||||||
j += MB_PTR2LEN(s2 + j);
|
j += MB_PTR2LEN(s2 + j);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return c1 == c2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -445,7 +445,7 @@ static int included_patches[] = {
|
|||||||
// 846 NA
|
// 846 NA
|
||||||
// 845,
|
// 845,
|
||||||
// 844,
|
// 844,
|
||||||
// 843,
|
843,
|
||||||
// 842 NA
|
// 842 NA
|
||||||
// 841 NA
|
// 841 NA
|
||||||
// 840 NA
|
// 840 NA
|
||||||
|
Loading…
Reference in New Issue
Block a user