summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2011-04-29 15:23:33 +0000
committerBart Schaefer <barts@users.sourceforge.net>2011-04-29 15:23:33 +0000
commit2938c58c82ddbd342e0750c15be2ced12bf98e3c (patch)
treeaf8c4a4e02610294010c5ea795ab4b7ee8d247a4
parent6a69eb2978f55cb5b2cd6c75478eb49234f68b26 (diff)
downloadzsh-2938c58c82ddbd342e0750c15be2ced12bf98e3c.tar.gz
zsh-2938c58c82ddbd342e0750c15be2ced12bf98e3c.tar.xz
zsh-2938c58c82ddbd342e0750c15be2ced12bf98e3c.zip
29107: replace overlapping strcpy with memmove
-rw-r--r--ChangeLog7
-rw-r--r--Src/Zle/zle_tricky.c8
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f5eb20b3..6230a0193 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-29  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 29107: Src/Zle/zle_tricky.c: replace overlapping strcpy with
+	memmove.
+
 2011-04-27  Mikael Magnusson <mikachu@gmail.com>
 
 	* 29051: Completion/Unix/Command/_make: add _make- prefix to
@@ -14529,5 +14534,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5265 $
+* $Revision: 1.5266 $
 *****************************************************
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index d3e30950d..74da24e6c 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1899,7 +1899,7 @@ get_comp_string(void)
 			*dbeg = '{';
 			i -= len;
 			boffs -= len;
-			strcpy(dbeg, dbeg + len);
+			memmove(dbeg, dbeg + len, 1+strlen(dbeg+len));
 			dp -= len;
 		    }
 		    bbeg = lastp = p;
@@ -1948,7 +1948,7 @@ get_comp_string(void)
 			*dbeg = '{';
 			i -= len;
 			boffs -= len;
-			strcpy(dbeg, dbeg + len);
+			memmove(dbeg, dbeg + len, 1+strlen(dbeg+len));
 			dp -= len;
 		    }
 		    bbeg = NULL;
@@ -2013,7 +2013,7 @@ get_comp_string(void)
 		new->qpos = strlen(quotename(predup, NULL));
 		*dbeg = '{';
 		boffs -= len;
-		strcpy(dbeg, dbeg + len);
+		memmove(dbeg, dbeg + len, 1+strlen(dbeg+len));
 	    }
 	    if (brend) {
 		Brinfo bp, prev = NULL;
@@ -2026,7 +2026,7 @@ get_comp_string(void)
 		    l = bp->qpos;
 		    bp->pos = strlen(predup + p + l);
 		    bp->qpos = strlen(quotename(predup + p + l, NULL));
-		    strcpy(predup + p, predup + p + l);
+		    memmove(predup + p, predup + p + l, 1+bp->pos);
 		}
 	    }
 	    if (hascom) {