summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/subst.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d2ba94afc..3037edda4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-23  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* Joey Pabalinas: 42313: Src/subst.c: avoid null-pointer deref
+	when using ${(PA)...} on an empty array result
+
 2018-01-23  Oliver Kiddle  <okiddle@yahoo.co.uk>
 
 	* 42317: Completion/Linux/Command/_cryptsetup,
diff --git a/Src/subst.c b/Src/subst.c
index d027e3d83..a265a187e 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2430,7 +2430,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 		val = aval[0];
 		isarr = 0;
 	    }
-	    s = dyncat(val, s);
+	    s = val ? dyncat(val, s) : dupstring(s);
 	    /* Now behave po-faced as if it was always like that... */
 	    subexp = 0;
 	    /*