about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2011-04-06 00:04:06 +0000
committerWayne Davison <wayned@users.sourceforge.net>2011-04-06 00:04:06 +0000
commit9e0b7684e578442f84d3983aad1e627bae87a4ce (patch)
tree48c58ec6635c534cd133a18eea29526042d0fd71
parent47d1215cb43a8b6388b1f6e3f8368676e6f2aa93 (diff)
downloadzsh-9e0b7684e578442f84d3983aad1e627bae87a4ce.tar.gz
zsh-9e0b7684e578442f84d3983aad1e627bae87a4ce.tar.xz
zsh-9e0b7684e578442f84d3983aad1e627bae87a4ce.zip
28977: fix copying of uninitialized memory when trying to
spell-correct a really long string.
-rw-r--r--ChangeLog7
-rw-r--r--Src/utils.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a8175b28f..e8c439bd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-05  Wayne Davison  <wayned@users.sourceforge.net>
+
+	* 28977: Src/utils.c: fix copying of uninitialized memory
+	when trying to spell-correct a really long string.
+
 2011-04-01  Peter Stephenson  <pws@csr.com>
 
 	* Stef van Vlierberghe: 28965 (as posted in 28967):
@@ -14420,5 +14425,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5240 $
+* $Revision: 1.5241 $
 *****************************************************
diff --git a/Src/utils.c b/Src/utils.c
index 9857303bb..22bffa276 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3684,6 +3684,8 @@ spname(char *oldname)
 	thresh = (int)(p - spnameguess) / 4 + 1;
 	if (thresh < 3)
 	    thresh = 3;
+	else if (thresh > 100)
+	    thresh = 100;
 	if ((thisdist = mindist(newname, spnameguess, spnamebest)) >= thresh) {
 	    /* The next test is always true, except for the first path    *
 	     * component.  We could initialize bestdist to some large     *