| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.843 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.4.843 (after 7.4.835) |
| Problem: Still possible to go beyond the end of a string. |
| Solution: Check for NUL also in second string. (Dominique Pelle) |
| Files: src/misc2.c |
| |
| |
| |
| |
| |
| *** 5059,5064 **** |
| --- 5059,5066 ---- |
| char_u *s2; |
| { |
| int i, j; |
| + int c1 = NUL; |
| + int c2 = NUL; |
| int prev1 = NUL; |
| int prev2 = NUL; |
| |
| |
| *** 5068,5088 **** |
| if (s1 == NULL || s2 == NULL) |
| return FALSE; |
| |
| ! for (i = 0, j = 0; s1[i] != NUL;) |
| { |
| ! int c1 = PTR2CHAR(s1 + i); |
| ! int c2 = PTR2CHAR(s2 + j); |
| |
| if ((p_fic ? MB_TOLOWER(c1) != MB_TOLOWER(c2) : c1 != c2) |
| && (prev1 != '*' || prev2 != '*')) |
| ! return FAIL; |
| prev2 = prev1; |
| prev1 = c1; |
| |
| i += MB_PTR2LEN(s1 + i); |
| j += MB_PTR2LEN(s2 + j); |
| } |
| ! return TRUE; |
| } |
| #endif |
| |
| --- 5070,5090 ---- |
| if (s1 == NULL || s2 == NULL) |
| return FALSE; |
| |
| ! for (i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) |
| { |
| ! c1 = PTR2CHAR(s1 + i); |
| ! c2 = PTR2CHAR(s2 + j); |
| |
| if ((p_fic ? MB_TOLOWER(c1) != MB_TOLOWER(c2) : c1 != c2) |
| && (prev1 != '*' || prev2 != '*')) |
| ! return FALSE; |
| prev2 = prev1; |
| prev1 = c1; |
| |
| i += MB_PTR2LEN(s1 + i); |
| j += MB_PTR2LEN(s2 + j); |
| } |
| ! return c1 == c2; |
| } |
| #endif |
| |
| |
| |
| |
| *** 743,744 **** |
| --- 743,746 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 843, |
| /**/ |
| |
| -- |
| Beer & pretzels can't be served at the same time in any bar or restaurant. |
| [real standing law in North Dakota, United States of America] |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |