about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-01-08 13:12:06 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-01-08 13:12:06 +0000
commitd69bd194b9a8f5079e42f4b9f23538435b22424c (patch)
treec132e8eaea1b4a210873aa0f45152a6924c78e86 /Src
parentbb883ca78fffb22ddeddfd3d1f09c4e601dac0a9 (diff)
downloadzsh-d69bd194b9a8f5079e42f4b9f23538435b22424c.tar.gz
zsh-d69bd194b9a8f5079e42f4b9f23538435b22424c.tar.xz
zsh-d69bd194b9a8f5079e42f4b9f23538435b22424c.zip
26260: fix crash failing to assigns scalar to special hash
Diffstat (limited to 'Src')
-rw-r--r--Src/params.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/Src/params.c b/Src/params.c
index 0faf667b9..1a826bff4 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -495,10 +495,10 @@ scancountparams(UNUSED(HashNode hn), int flags)
 static Patprog scanprog;
 static char *scanstr;
 static char **paramvals;
-static Param foundparam;     
+static Param foundparam;
 
 /**/
-void
+static void
 scanparamvals(HashNode hn, int flags)
 {
     struct value v;
@@ -538,6 +538,7 @@ scanparamvals(HashNode hn, int flags)
 	    --numparamvals;	/* Value didn't match, discard key */
     } else
 	++numparamvals;
+    foundparam = NULL;
 }
 
 /**/
@@ -2270,7 +2271,15 @@ setstrvalue(Value v, char *val)
 	break;
     case PM_HASHED:
         {
-	    foundparam->gsu.s->setfn(foundparam, val);
+	    if (foundparam == NULL)
+	    {
+		zerr("%s: attempt to set associative array to scalar",
+		     v->pm->node.nam);
+		zsfree(val);
+		return;
+	    }
+	    else
+		foundparam->gsu.s->setfn(foundparam, val);
         }
 	break;
     }