Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.1.156
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.1.156
Problem:    Overlapping arguments for strcpy() when expanding command line
	    variables.
Solution:   Use mch_memmove() instead of STRCPY().  Also fix a few typos.
	    (Dominique Pelle)
Files:	    src/ex_docmd.c


*** ../vim-7.1.155/src/ex_docmd.c	Fri Oct 19 16:20:09 2007
--- src/ex_docmd.c	Sat Nov 10 12:39:51 2007
***************
*** 666,672 ****
  		if (ex_pressedreturn)
  		{
  		    /* go up one line, to overwrite the ":<CR>" line, so the
! 		     * output doensn't contain empty lines. */
  		    msg_row = prev_msg_row;
  		    if (prev_msg_row == Rows - 1)
  			msg_row--;
--- 666,672 ----
  		if (ex_pressedreturn)
  		{
  		    /* go up one line, to overwrite the ":<CR>" line, so the
! 		     * output doesn't contain empty lines. */
  		    msg_row = prev_msg_row;
  		    if (prev_msg_row == Rows - 1)
  			msg_row--;
***************
*** 2760,2766 ****
  
      /*
       * Isolate the command and search for it in the command table.
!      * Exeptions:
       * - the 'k' command can directly be followed by any character.
       * - the 's' command can be followed directly by 'c', 'g', 'i', 'I' or 'r'
       *	    but :sre[wind] is another command, as are :scrip[tnames],
--- 2760,2766 ----
  
      /*
       * Isolate the command and search for it in the command table.
!      * Exceptions:
       * - the 'k' command can directly be followed by any character.
       * - the 's' command can be followed directly by 'c', 'g', 'i', 'I' or 'r'
       *	    but :sre[wind] is another command, as are :scrip[tnames],
***************
*** 6677,6683 ****
   * The list should be allocated using alloc(), as should each item in the
   * list. This function takes over responsibility for freeing the list.
   *
!  * XXX The list is made into the arggument list. This is freed using
   * FreeWild(), which does a series of vim_free() calls, unless the two defines
   * __EMX__ and __ALWAYS_HAS_TRAILING_NUL_POINTER are set. In this case, a
   * routine _fnexplodefree() is used. This may cause problems, but as the drop
--- 6677,6683 ----
   * The list should be allocated using alloc(), as should each item in the
   * list. This function takes over responsibility for freeing the list.
   *
!  * XXX The list is made into the argument list. This is freed using
   * FreeWild(), which does a series of vim_free() calls, unless the two defines
   * __EMX__ and __ALWAYS_HAS_TRAILING_NUL_POINTER are set. In this case, a
   * routine _fnexplodefree() is used. This may cause problems, but as the drop
***************
*** 7795,7801 ****
  	if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
  							     && !eap->forceit)
  	{
! 	    EMSG(_("E747: Cannot change directory, buffer is modifed (add ! to override)"));
  	    return;
  	}
  
--- 7795,7801 ----
  	if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
  							     && !eap->forceit)
  	{
! 	    EMSG(_("E747: Cannot change directory, buffer is modified (add ! to override)"));
  	    return;
  	}
  
***************
*** 9391,9397 ****
      if (src > srcstart && src[-1] == '\\')
      {
  	*usedlen = 0;
! 	STRCPY(src - 1, src);		/* remove backslash */
  	return NULL;
      }
  
--- 9391,9397 ----
      if (src > srcstart && src[-1] == '\\')
      {
  	*usedlen = 0;
! 	mch_memmove(src - 1, src, STRLEN(src) + 1);	/* remove backslash */
  	return NULL;
      }
  
*** ../vim-7.1.155/src/version.c	Sat Nov 10 22:50:20 2007
--- src/version.c	Sun Nov 11 19:15:51 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     156,
  /**/

-- 
Common sense is what tells you that the world is flat.

 /// 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    ///