about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-01-04 12:21:06 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-01-04 12:21:06 +0000
commitb397fbbe7a1d2cbf65f7661eeece4dd39dedd5be (patch)
tree3b9c130d32409dba2791983882e67035d756d7fc
parentf080ccb15a6fa60f98afec31fef53b2f2cd72f93 (diff)
downloadzsh-b397fbbe7a1d2cbf65f7661eeece4dd39dedd5be.tar.gz
zsh-b397fbbe7a1d2cbf65f7661eeece4dd39dedd5be.tar.xz
zsh-b397fbbe7a1d2cbf65f7661eeece4dd39dedd5be.zip
27556: sanitize more variables in lexsave()
avoiding crashes in inner loops
-rw-r--r--ChangeLog8
-rw-r--r--Src/lex.c5
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7f9cf807b..1d8f77298 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-04  Peter Stephenson  <pws@csr.com>
+
+	* 27556: Src/lex.c: lexsave() should sanitize more variables else
+	inner loops can get confused by outer state.  Symptom was
+	source within precmd.
+
 2009-12-28  Clint Adams  <clint@zsh.org>
 
 	* Chris Lamb: 27545: Completion/Unix/Command/_django:
@@ -12523,5 +12529,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4849 $
+* $Revision: 1.4850 $
 *****************************************************
diff --git a/Src/lex.c b/Src/lex.c
index f7e87477a..f25bd3eca 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -248,8 +248,11 @@ lexsave(void)
     ls->histactive = histactive;
     ls->histdone = histdone;
     ls->stophist = stophist;
+    stophist = 0;
     ls->hline = chline;
+    chline = NULL;
     ls->hptr = hptr;
+    hptr = NULL;
     ls->hlinesz = hlinesz;
     ls->cstack = cmdstack;
     ls->csp = cmdsp;
@@ -259,7 +262,9 @@ lexsave(void)
     ls->tokstr = tokstr;
     ls->zshlextext = zshlextext;
     ls->bptr = bptr;
+    tokstr = zshlextext = bptr = NULL;
     ls->bsiz = bsiz;
+    bsiz = 256;
     ls->len = len;
     ls->chwords = chwords;
     ls->chwordlen = chwordlen;