Skip to contentSkip to conversation

lib-globc-added-null-check-for-character-class.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Sep 9, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: lib: glob.c: added null check for character class
has been removed from the -mm tree. Its filename was
lib-globc-added-null-check-for-character-class.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Alok Swaminathan <[email protected]>
Subject: lib: glob.c: added null check for character class
Date: Mon, 26 Aug 2024 11:57:09 -0400

Add null check for character class. Previously, an inverted character class could result in a nul byte being matched and lead to the function reading past the end of the inputted string.

---

 lib/glob.c |    2 ++
 1 file changed, 2 insertions(+)
lib/glob.c renamed from lib/glob.c~lib-globc-added-null-check-for-character-class +2 -0
@@ -68,6 +68,8 @@ bool __pure glob_match(char const *pat,
 			back_str = --str;	/* Allow zero-length match */
 			break;
 		case '[': {	/* Character class */
+			if (c == '\0')	/* No possible match */
+				return false;
 			bool match = false, inverted = (*pat == '!');
 			char const *class = pat + inverted;
 			unsigned char a = *class++;

_

Patches currently in -mm which might be from [email protected] are