Petr Šabata 33fc6c
From d894cfd104086ddf68c286e67a5fb2e02eb43b7b Mon Sep 17 00:00:00 2001
Petr Šabata 33fc6c
From: Chet Ramey <chet.ramey@case.edu>
Petr Šabata 33fc6c
Date: Thu, 29 Aug 2019 11:21:20 -0400
Petr Šabata 33fc6c
Subject: [PATCH] Bash-5.0 patch 11: fix quoted null character removal in
Petr Šabata 33fc6c
 operands of conditional ([[) commands
Petr Šabata 33fc6c
Petr Šabata 33fc6c
---
Petr Šabata 33fc6c
 patchlevel.h | 2 +-
Petr Šabata 33fc6c
 subst.c      | 6 +++++-
Petr Šabata 33fc6c
 2 files changed, 6 insertions(+), 2 deletions(-)
Petr Šabata 33fc6c
Petr Šabata 33fc6c
diff --git a/patchlevel.h b/patchlevel.h
Petr Šabata 33fc6c
index 8002af70..772676c8 100644
Petr Šabata 33fc6c
--- a/patchlevel.h
Petr Šabata 33fc6c
+++ b/patchlevel.h
Petr Šabata 33fc6c
@@ -25,6 +25,6 @@
Petr Šabata 33fc6c
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
Petr Šabata 33fc6c
    looks for to find the patch level (for the sccs version string). */
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
-#define PATCHLEVEL 10
Petr Šabata 33fc6c
+#define PATCHLEVEL 11
Petr Šabata 33fc6c
 
Petr Šabata 33fc6c
 #endif /* _PATCHLEVEL_H_ */
Petr Šabata 33fc6c
diff --git a/subst.c b/subst.c
Petr Šabata 33fc6c
index 95591878..fd6db240 100644
Petr Šabata 33fc6c
--- a/subst.c
Petr Šabata 33fc6c
+++ b/subst.c
Petr Šabata 33fc6c
@@ -3625,7 +3625,9 @@ remove_backslashes (string)
Petr Šabata 33fc6c
    this case, we quote the string specially for the globbing code.  If
Petr Šabata 33fc6c
    SPECIAL is 2, this is an rhs argument for the =~ operator, and should
Petr Šabata 33fc6c
    be quoted appropriately for regcomp/regexec.  The caller is responsible
Petr Šabata 33fc6c
-   for removing the backslashes if the unquoted word is needed later. */   
Petr Šabata 33fc6c
+   for removing the backslashes if the unquoted word is needed later. In
Petr Šabata 33fc6c
+   any case, since we don't perform word splitting, we need to do quoted
Petr Šabata 33fc6c
+   null character removal. */
Petr Šabata 33fc6c
 char *
Petr Šabata 33fc6c
 cond_expand_word (w, special)
Petr Šabata 33fc6c
      WORD_DESC *w;
Petr Šabata 33fc6c
@@ -3646,6 +3648,8 @@ cond_expand_word (w, special)
Petr Šabata 33fc6c
     {
Petr Šabata 33fc6c
       if (special == 0)			/* LHS */
Petr Šabata 33fc6c
 	{
Petr Šabata 33fc6c
+	  if (l->word)
Petr Šabata 33fc6c
+	    word_list_remove_quoted_nulls (l);
Petr Šabata 33fc6c
 	  dequote_list (l);
Petr Šabata 33fc6c
 	  r = string_list (l);
Petr Šabata 33fc6c
 	}
Petr Šabata 33fc6c
-- 
Petr Šabata 33fc6c
2.21.0
Petr Šabata 33fc6c