From 4f59a8babc53a9f975078c4a003bdc8831c5ee22 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 14 Nov 2016 14:27:23 -0500
Subject: [PATCH] Bash-4.4 patch 3

---
 lib/glob/sm_loop.c | 9 +++++++++
 patchlevel.h       | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/glob/sm_loop.c b/lib/glob/sm_loop.c
index c3a2aa3..65179e2 100644
--- a/lib/glob/sm_loop.c
+++ b/lib/glob/sm_loop.c
@@ -330,6 +330,12 @@ PARSE_COLLSYM (p, vp)
   for (pc = 0; p[pc]; pc++)
     if (p[pc] == L('.') && p[pc+1] == L(']'))
       break;
+   if (p[pc] == 0)
+    {
+      if (vp)
+	*vp = INVALID;
+      return (p + pc);
+    }
    val = COLLSYM (p, pc);
    if (vp)
      *vp = val;
@@ -483,6 +489,9 @@ BRACKMATCH (p, test, flags)
       c = *p++;
       c = FOLD (c);
 
+      if (c == L('\0'))
+	return ((test == L('[')) ? savep : (CHAR *)0);
+
       if ((flags & FNM_PATHNAME) && c == L('/'))
 	/* [/] can never match when matching a pathname.  */
 	return (CHAR *)0;
diff --git a/patchlevel.h b/patchlevel.h
index a988d85..e7e960c 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
    looks for to find the patch level (for the sccs version string). */
 
-#define PATCHLEVEL 2
+#define PATCHLEVEL 3
 
 #endif /* _PATCHLEVEL_H_ */
-- 
2.9.3

