Karsten Hopp 1cb839
To: vim-dev@vim.org
Karsten Hopp 1cb839
Subject: patch 7.1.055
Karsten Hopp 1cb839
Fcc: outbox
Karsten Hopp 1cb839
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 1cb839
Mime-Version: 1.0
Karsten Hopp 1cb839
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 1cb839
Content-Transfer-Encoding: 8bit
Karsten Hopp 1cb839
------------
Karsten Hopp 1cb839
Karsten Hopp 1cb839
Patch 7.1.055
Karsten Hopp 1cb839
Problem:    Using strcpy() with arguments that overlap.
Karsten Hopp 1cb839
Solution:   Use mch_memmove() instead.
Karsten Hopp 1cb839
Files:	    src/buffer.c, src/charset.c, src/eval.c, src/ex_getln.c,
Karsten Hopp 1cb839
	    src/misc1.c, src/regexp.c, src/termlib.c
Karsten Hopp 1cb839
Karsten Hopp 1cb839
Karsten Hopp 1cb839
*** ../vim-7.1.054/src/buffer.c	Tue Jun 19 15:40:51 2007
Karsten Hopp 1cb839
--- src/buffer.c	Sun Aug  5 16:14:03 2007
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 4860,4866 ****
Karsten Hopp 1cb839
  	     */
Karsten Hopp 1cb839
  	    for (e = s; *e != ':' && *e != NUL; ++e)
Karsten Hopp 1cb839
  		if (e[0] == '\\' && e[1] == ':')
Karsten Hopp 1cb839
! 		    STRCPY(e, e + 1);
Karsten Hopp 1cb839
  	    if (*e == NUL)
Karsten Hopp 1cb839
  		end = TRUE;
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
--- 4860,4866 ----
Karsten Hopp 1cb839
  	     */
Karsten Hopp 1cb839
  	    for (e = s; *e != ':' && *e != NUL; ++e)
Karsten Hopp 1cb839
  		if (e[0] == '\\' && e[1] == ':')
Karsten Hopp 1cb839
! 		    mch_memmove(e, e + 1, STRLEN(e));
Karsten Hopp 1cb839
  	    if (*e == NUL)
Karsten Hopp 1cb839
  		end = TRUE;
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
*** ../vim-7.1.054/src/charset.c	Tue Mar 27 12:41:45 2007
Karsten Hopp 1cb839
--- src/charset.c	Sun Aug  5 21:53:44 2007
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 1898,1904 ****
Karsten Hopp 1cb839
  {
Karsten Hopp 1cb839
      for ( ; *p; ++p)
Karsten Hopp 1cb839
  	if (rem_backslash(p))
Karsten Hopp 1cb839
! 	    STRCPY(p, p + 1);
Karsten Hopp 1cb839
  }
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
  /*
Karsten Hopp 1cb839
--- 1898,1904 ----
Karsten Hopp 1cb839
  {
Karsten Hopp 1cb839
      for ( ; *p; ++p)
Karsten Hopp 1cb839
  	if (rem_backslash(p))
Karsten Hopp 1cb839
! 	    mch_memmove(p, p + 1, STRLEN(p));
Karsten Hopp 1cb839
  }
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
  /*
Karsten Hopp 1cb839
*** ../vim-7.1.054/src/eval.c	Fri Jul 27 21:32:13 2007
Karsten Hopp 1cb839
--- src/eval.c	Sun Aug  5 16:25:03 2007
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 13807,13813 ****
Karsten Hopp 1cb839
  	    }
Karsten Hopp 1cb839
  	    /* Shorten "remain". */
Karsten Hopp 1cb839
  	    if (*q != NUL)
Karsten Hopp 1cb839
! 		STRCPY(remain, q - 1);
Karsten Hopp 1cb839
  	    else
Karsten Hopp 1cb839
  	    {
Karsten Hopp 1cb839
  		vim_free(remain);
Karsten Hopp 1cb839
--- 13807,13813 ----
Karsten Hopp 1cb839
  	    }
Karsten Hopp 1cb839
  	    /* Shorten "remain". */
Karsten Hopp 1cb839
  	    if (*q != NUL)
Karsten Hopp 1cb839
! 		mch_memmove(remain, q - 1, STRLEN(q - 1) + 1);
Karsten Hopp 1cb839
  	    else
Karsten Hopp 1cb839
  	    {
Karsten Hopp 1cb839
  		vim_free(remain);
Karsten Hopp 1cb839
*** ../vim-7.1.054/src/ex_getln.c	Sat Jul 28 14:21:04 2007
Karsten Hopp 1cb839
--- src/ex_getln.c	Sun Aug  5 21:55:56 2007
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 4306,4315 ****
Karsten Hopp 1cb839
  			    && pat[i + 1] == '\\'
Karsten Hopp 1cb839
  			    && pat[i + 2] == '\\'
Karsten Hopp 1cb839
  			    && pat[i + 3] == ' ')
Karsten Hopp 1cb839
! 			STRCPY(pat + i, pat + i + 3);
Karsten Hopp 1cb839
  		    if (xp->xp_backslash == XP_BS_ONE
Karsten Hopp 1cb839
  			    && pat[i + 1] == ' ')
Karsten Hopp 1cb839
! 			STRCPY(pat + i, pat + i + 1);
Karsten Hopp 1cb839
  		}
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
--- 4306,4316 ----
Karsten Hopp 1cb839
  			    && pat[i + 1] == '\\'
Karsten Hopp 1cb839
  			    && pat[i + 2] == '\\'
Karsten Hopp 1cb839
  			    && pat[i + 3] == ' ')
Karsten Hopp 1cb839
! 			mch_memmove(pat + i, pat + i + 3,
Karsten Hopp 1cb839
! 						     STRLEN(pat + i + 3) + 1);
Karsten Hopp 1cb839
  		    if (xp->xp_backslash == XP_BS_ONE
Karsten Hopp 1cb839
  			    && pat[i + 1] == ' ')
Karsten Hopp 1cb839
! 			mch_memmove(pat + i, pat + i + 1, STRLEN(pat + i));
Karsten Hopp 1cb839
  		}
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 4552,4558 ****
Karsten Hopp 1cb839
      pat = vim_strsave(filepat);
Karsten Hopp 1cb839
      for (i = 0; pat[i]; ++i)
Karsten Hopp 1cb839
  	if (pat[i] == '\\' && pat[i + 1] == ' ')
Karsten Hopp 1cb839
! 	    STRCPY(pat + i, pat + i + 1);
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
      flags |= EW_FILE | EW_EXEC;
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
--- 4553,4559 ----
Karsten Hopp 1cb839
      pat = vim_strsave(filepat);
Karsten Hopp 1cb839
      for (i = 0; pat[i]; ++i)
Karsten Hopp 1cb839
  	if (pat[i] == '\\' && pat[i + 1] == ' ')
Karsten Hopp 1cb839
! 	    mch_memmove(pat + i, pat + i + 1, STRLEN(pat + i));
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
      flags |= EW_FILE | EW_EXEC;
Karsten Hopp 1cb839
  
Karsten Hopp 1cb839
*** ../vim-7.1.054/src/misc1.c	Sat Aug  4 12:14:04 2007
Karsten Hopp 1cb839
--- src/misc1.c	Sun Aug  5 21:57:15 2007
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 8635,8641 ****
Karsten Hopp 1cb839
      for (p = buf + wildoff; p < s; ++p)
Karsten Hopp 1cb839
  	if (rem_backslash(p))
Karsten Hopp 1cb839
  	{
Karsten Hopp 1cb839
! 	    STRCPY(p, p + 1);
Karsten Hopp 1cb839
  	    --e;
Karsten Hopp 1cb839
  	    --s;
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
--- 8635,8641 ----
Karsten Hopp 1cb839
      for (p = buf + wildoff; p < s; ++p)
Karsten Hopp 1cb839
  	if (rem_backslash(p))
Karsten Hopp 1cb839
  	{
Karsten Hopp 1cb839
! 	    mch_memmove(p, p + 1, STRLEN(p));
Karsten Hopp 1cb839
  	    --e;
Karsten Hopp 1cb839
  	    --s;
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 8936,8942 ****
Karsten Hopp 1cb839
      for (p = buf + wildoff; p < s; ++p)
Karsten Hopp 1cb839
  	if (rem_backslash(p))
Karsten Hopp 1cb839
  	{
Karsten Hopp 1cb839
! 	    STRCPY(p, p + 1);
Karsten Hopp 1cb839
  	    --e;
Karsten Hopp 1cb839
  	    --s;
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
--- 8936,8942 ----
Karsten Hopp 1cb839
      for (p = buf + wildoff; p < s; ++p)
Karsten Hopp 1cb839
  	if (rem_backslash(p))
Karsten Hopp 1cb839
  	{
Karsten Hopp 1cb839
! 	    mch_memmove(p, p + 1, STRLEN(p));
Karsten Hopp 1cb839
  	    --e;
Karsten Hopp 1cb839
  	    --s;
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
*** ../vim-7.1.054/src/regexp.c	Mon Jul 30 22:32:11 2007
Karsten Hopp 1cb839
--- src/regexp.c	Sun Aug  5 15:43:27 2007
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 6637,6645 ****
Karsten Hopp 1cb839
  		}
Karsten Hopp 1cb839
  	    }
Karsten Hopp 1cb839
  	    else if (magic)
Karsten Hopp 1cb839
! 		STRCPY(p, p + 1);		/* remove '~' */
Karsten Hopp 1cb839
  	    else
Karsten Hopp 1cb839
! 		STRCPY(p, p + 2);		/* remove '\~' */
Karsten Hopp 1cb839
  	    --p;
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
  	else
Karsten Hopp 1cb839
--- 6638,6646 ----
Karsten Hopp 1cb839
  		}
Karsten Hopp 1cb839
  	    }
Karsten Hopp 1cb839
  	    else if (magic)
Karsten Hopp 1cb839
! 		mch_memmove(p, p + 1, STRLEN(p));	/* remove '~' */
Karsten Hopp 1cb839
  	    else
Karsten Hopp 1cb839
! 		mch_memmove(p, p + 2, STRLEN(p) - 1);	/* remove '\~' */
Karsten Hopp 1cb839
  	    --p;
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
  	else
Karsten Hopp 1cb839
*** ../vim-7.1.054/src/termlib.c	Thu May 10 20:20:59 2007
Karsten Hopp 1cb839
--- src/termlib.c	Sun Aug  5 21:52:41 2007
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 191,197 ****
Karsten Hopp 1cb839
  	    lbuf[0] == '\t' &&
Karsten Hopp 1cb839
  	    lbuf[1] == ':')
Karsten Hopp 1cb839
  	{
Karsten Hopp 1cb839
! 	    strcpy(lbuf, lbuf+2);
Karsten Hopp 1cb839
  	    llen -= 2;
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
  	if (lbuf[llen-2] == '\\')		/* and continuations */
Karsten Hopp 1cb839
--- 191,197 ----
Karsten Hopp 1cb839
  	    lbuf[0] == '\t' &&
Karsten Hopp 1cb839
  	    lbuf[1] == ':')
Karsten Hopp 1cb839
  	{
Karsten Hopp 1cb839
! 	    mch_memmove(lbuf, lbuf + 2, strlen(lbuf + 2) + 1);
Karsten Hopp 1cb839
  	    llen -= 2;
Karsten Hopp 1cb839
  	}
Karsten Hopp 1cb839
  	if (lbuf[llen-2] == '\\')		/* and continuations */
Karsten Hopp 1cb839
*** ../vim-7.1.054/src/version.c	Sun Aug  5 20:10:16 2007
Karsten Hopp 1cb839
--- src/version.c	Mon Aug  6 21:34:54 2007
Karsten Hopp 1cb839
***************
Karsten Hopp 1cb839
*** 668,669 ****
Karsten Hopp 1cb839
--- 668,671 ----
Karsten Hopp 1cb839
  {   /* Add new patch number below this line */
Karsten Hopp 1cb839
+ /**/
Karsten Hopp 1cb839
+     55,
Karsten Hopp 1cb839
  /**/
Karsten Hopp 1cb839
Karsten Hopp 1cb839
-- 
Karsten Hopp 1cb839
From "know your smileys":
Karsten Hopp 1cb839
 %	Bike accident.  A bit far-fetched, I suppose; although...
Karsten Hopp 1cb839
             o      _     _         _
Karsten Hopp 1cb839
     _o     /\_   _ \\o  (_)\__/o  (_)
Karsten Hopp 1cb839
   _< \_   _>(_) (_)/<_    \_| \   _|/' \/
Karsten Hopp 1cb839
  (_)>(_) (_)        (_)   (_)    (_)'  _\o_
Karsten Hopp 1cb839
Karsten Hopp 1cb839
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 1cb839
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 1cb839
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 1cb839
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///