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:
Jurica Bradaric 2016-02-09 22:59:16 +01:00
parent ab8a771dbd
commit c9898e0ec3
2 changed files with 8 additions and 6 deletions

View File

@ -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)
{
int c1 = NUL;
int c2 = NUL;
int prev1 = NUL;
int prev2 = NUL;
@ -1066,13 +1068,13 @@ static int ff_wc_equal(char_u *s1, char_u *s2)
if (s1 == NULL || s2 == NULL)
return FALSE;
for (int i = 0, j = 0; s1[i] != NUL;) {
int c1 = PTR2CHAR(s1 + i);
int c2 = PTR2CHAR(s2 + j);
for (int i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) {
c1 = PTR2CHAR(s1 + i);
c2 = PTR2CHAR(s2 + j);
if ((p_fic ? vim_tolower(c1) != vim_tolower(c2) : c1 != c2)
&& (prev1 != '*' || prev2 != '*')) {
return FAIL;
return false;
}
prev2 = prev1;
prev1 = c1;
@ -1080,7 +1082,7 @@ static int ff_wc_equal(char_u *s1, char_u *s2)
i += MB_PTR2LEN(s1 + i);
j += MB_PTR2LEN(s2 + j);
}
return TRUE;
return c1 == c2;
}
/*

View File

@ -445,7 +445,7 @@ static int included_patches[] = {
// 846 NA
// 845,
// 844,
// 843,
843,
// 842 NA
// 841 NA
// 840 NA