about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-01-10 10:25:31 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-01-10 10:25:31 +0000
commited5c4c8e53fce85c1f450c6493b888e4dc223dcf (patch)
tree4f9064cc5332cab7f731266b4bcad882638395b2
parent5be52f092a696040f3f0e21a9fa337cc12837e4e (diff)
downloadzsh-ed5c4c8e53fce85c1f450c6493b888e4dc223dcf.tar.gz
zsh-ed5c4c8e53fce85c1f450c6493b888e4dc223dcf.tar.xz
zsh-ed5c4c8e53fce85c1f450c6493b888e4dc223dcf.zip
24384 plus extra check: care with scanprog
-rw-r--r--ChangeLog5
-rw-r--r--Src/params.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 55cf5d102..d0edf2f4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-10  Peter Stephenson  <pws@csr.com>
+
+	* 24384: Src/params.c: eliminate invalid pointer and also
+	(unposted) add debug check for use.
+
 2008-01-08  Peter Stephenson  <pws@csr.com>
 
 	* unposted: 4.3.4-dev-7.
diff --git a/Src/params.c b/Src/params.c
index a8a0f7780..f7534472c 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -542,6 +542,8 @@ scanparamvals(HashNode hn, int flags)
 char **
 paramvalarr(HashTable ht, int flags)
 {
+    DPUTS((flags & (SCANPM_MATCHKEY|SCANPM_MATCHVAL)) && !scanprog,
+	  "BUG: scanning hash without scanprog set");
     numparamvals = 0;
     if (ht)
 	scanhashtable(ht, 0, 0, PM_UNSET, scancountparams, flags);
@@ -1308,8 +1310,10 @@ getarg(char **str, int *inv, Value v, int a2, zlong *w,
 					  SCANPM_KEYMATCH))))) {
 		    *inv = (v->flags & VALFLAG_INV) ? 1 : 0;
 		    *w = v->end;
+		    scanprog = NULL;
 		    return 1;
 		}
+		scanprog = NULL;
 	    } else
 		ta = getarrvalue(v);
 	    if (!ta || !*ta)