summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2021-12-21 10:31:26 +0000
committerPeter Stephenson <p.stephenson@samsung.com>2021-12-21 10:31:26 +0000
commit7f240e6aa9f5596a129474ba6294875dfe7ae264 (patch)
tree23a443272d40f3aa223f8ffe9149777c937217b8
parentb7490d337676b212be881bf692cb0db78ed42bc2 (diff)
downloadzsh-7f240e6aa9f5596a129474ba6294875dfe7ae264.tar.gz
zsh-7f240e6aa9f5596a129474ba6294875dfe7ae264.tar.xz
zsh-7f240e6aa9f5596a129474ba6294875dfe7ae264.zip
49658: Fix NULL reference in match code.
A test when acquiring the replacement pattern match in the globbing
code erroneously allowed the use of a NULL pointer.  This appears to
be an unnecessary test case added alongside other surgery back in 2008.
-rw-r--r--ChangeLog5
-rw-r--r--Src/glob.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 17d6cbc96..270cf39ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-12-21  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 49658: Src/glob.c: Remove erroneous use of NULL pointer for
+	replacement pattern match.
+
 2021-12-21  Oliver Kiddle  <opk@zsh.org>
 
 	* 49655 based on 34928 (Daniel Hahler):
diff --git a/Src/glob.c b/Src/glob.c
index bee890caf..375671cea 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -2549,7 +2549,7 @@ get_match_ret(Imatchdata imd, int b, int e)
     e += add;
 
     /* Everything now refers to metafied lengths. */
-    if (replstr || (fl & SUB_LIST)) {
+    if (replstr) {
 	if (fl & SUB_DOSUBST) {
 	    replstr = dupstring(replstr);
 	    singsub(&replstr);