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