Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.2.157
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.157
Problem:    Illegal memory access when searching in path.
Solution:   Avoid looking at a byte after end of a string. (Dominique Pelle)
Files:	    src/search.c


*** ../vim-7.2.156/src/search.c	Fri Jul 18 12:05:58 2008
--- src/search.c	Wed Apr 22 12:26:19 2009
***************
*** 2327,2334 ****
  		    for (col = pos.col; check_prevcol(linep, col, '\\', &col);)
  			bslcnt++;
  		}
! 		/* Only accept a match when 'M' is in 'cpo' or when ecaping is
! 		 * what we expect. */
  		if (cpo_bsl || (bslcnt & 1) == match_escaped)
  		{
  		    if (c == initc)
--- 2336,2343 ----
  		    for (col = pos.col; check_prevcol(linep, col, '\\', &col);)
  			bslcnt++;
  		}
! 		/* Only accept a match when 'M' is in 'cpo' or when escaping
! 		 * is what we expect. */
  		if (cpo_bsl || (bslcnt & 1) == match_escaped)
  		{
  		    if (c == initc)
***************
*** 4663,4669 ****
  			    msg_putchar('\n');	    /* cursor below last one */
  			    if (!got_int)	    /* don't display if 'q'
  						       typed at "--more--"
! 						       mesage */
  			    {
  				msg_home_replace_hl(new_fname);
  				MSG_PUTS(_(" (includes previously listed match)"));
--- 4672,4678 ----
  			    msg_putchar('\n');	    /* cursor below last one */
  			    if (!got_int)	    /* don't display if 'q'
  						       typed at "--more--"
! 						       message */
  			    {
  				msg_home_replace_hl(new_fname);
  				MSG_PUTS(_(" (includes previously listed match)"));
***************
*** 4975,4981 ****
  					    || IObuff[i-2] == '!'))))
  				IObuff[i++] = ' ';
  			}
! 			/* copy as much as posible of the new word */
  			if (p - aux >= IOSIZE - i)
  			    p = aux + IOSIZE - i - 1;
  			STRNCPY(IObuff + i, aux, p - aux);
--- 4984,4990 ----
  					    || IObuff[i-2] == '!'))))
  				IObuff[i++] = ' ';
  			}
! 			/* copy as much as possible of the new word */
  			if (p - aux >= IOSIZE - i)
  			    p = aux + IOSIZE - i - 1;
  			STRNCPY(IObuff + i, aux, p - aux);
***************
*** 5010,5016 ****
  		    if (did_show)
  			msg_putchar('\n');	/* cursor below last one */
  		    if (!got_int)		/* don't display if 'q' typed
! 						    at "--more--" mesage */
  			msg_home_replace_hl(curr_fname);
  		    prev_fname = curr_fname;
  		}
--- 5019,5025 ----
  		    if (did_show)
  			msg_putchar('\n');	/* cursor below last one */
  		    if (!got_int)		/* don't display if 'q' typed
! 						    at "--more--" message */
  			msg_home_replace_hl(curr_fname);
  		    prev_fname = curr_fname;
  		}
***************
*** 5092,5098 ****
  		}
  		if (action != ACTION_SHOW)
  		{
! 		    curwin->w_cursor.col = (colnr_T) (startp - line);
  		    curwin->w_set_curswant = TRUE;
  		}
  
--- 5101,5107 ----
  		}
  		if (action != ACTION_SHOW)
  		{
! 		    curwin->w_cursor.col = (colnr_T)(startp - line);
  		    curwin->w_set_curswant = TRUE;
  		}
  
***************
*** 5119,5125 ****
  		    && action == ACTION_EXPAND
  		    && !(compl_cont_status & CONT_SOL)
  #endif
! 		    && *(p = startp + 1))
  		goto search_line;
  	}
  	line_breakcheck();
--- 5128,5135 ----
  		    && action == ACTION_EXPAND
  		    && !(compl_cont_status & CONT_SOL)
  #endif
! 		    && *startp != NUL
! 		    && *(p = startp + 1) != NUL)
  		goto search_line;
  	}
  	line_breakcheck();
*** ../vim-7.2.156/src/version.c	Wed Apr 22 16:22:44 2009
--- src/version.c	Wed Apr 22 16:39:59 2009
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     157,
  /**/


-- 
ARTHUR:  Bloody peasant!
DENNIS:  Oh, what a give away.  Did you hear that, did you hear that, eh?
         That's what I'm on about -- did you see him repressing me, you saw it
         didn't you?
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///