From nobody Tue Apr 7 07:08:24 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F44B374756 for ; Sun, 15 Mar 2026 17:11:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773594674; cv=pass; b=dhZF1x5euIkioR937bTEntRdy5iXbtAKRyYBalLNIqFnRoKiktfJg7Zgtk4mdCKUpHt05HeF846Iu4Q15PpPT393Exg5XqNI4t2qhkh1CgsXce7IXZhfiUxVUFQdiYBHTHiv+nC0a7xckpE62GN8vPnJ3LzjhrI361YYHgqsdM0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773594674; c=relaxed/simple; bh=ynosWAVdTZjwHIldBKnJyOHFf6YCnzrYK/oMhyqjJmI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MISI9snKtn6T+Hs8dKcQIvQYPlo537HS2x06v6NrBfsoBOBosDo7ynlOb1T9jbZFT9KeRxSeuLgxkEWWl3LI/5HTHLo4yFhit59R52dtmnkvtEzisFjrcUIlY20DQO6/UdhAZtfXW33opgcr+BNuRKkrqhDKL39Sy4mf1T5hIGg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=IHtN42lC; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="IHtN42lC" ARC-Seal: i=1; a=rsa-sha256; t=1773594669; cv=none; d=zohomail.eu; s=zohoarc; b=UHtOPDacwTiWvD6Rj/gRJymWicQ/H+L3kkrXkzsfEZz6ISNRyljaocCjPbQd6QoyJReoddsIVFBext6AaRaLGzmP0q5BxRMWfDjC12+N5+X2JhxgddsGHaHBC83O+LNqsdf16Ne7n5kcxrMFjS5XmRZL2LcahwAYycV4O6OKx+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773594669; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=ueSZI5AfyJ2dJY/ym+gJvwLv50twR0Whfk1qSI94zoM=; b=kmkbb1RJLYpw73B7SknZ3vcGXM+FliFhnhuBvP5tOz7VgCCRQ9Oq8oN6ZEdOVvK6ykAekAGYsBkoyUJ9MHgeXYYYz9emhnj5fCwMq7DLSUsVHN6ZncFA7o5cvxB2efGD4ENTmj/BwjNxx6SufHl/34tAAop6xqJJFwj4y8CJHwk= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1773594669; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=ueSZI5AfyJ2dJY/ym+gJvwLv50twR0Whfk1qSI94zoM=; b=IHtN42lC3ZADYl+r1eTTosvPNLu7NCZRpqPPhmaxmcypa7tPoL8yQ+/0CNCPvTCM lDKpLmUXgFayKKDHAxubnFvILYMvkfbPUCKO2cEcmQ03qU+MyLuCqANyGASpHhUkRfC +3IwMWhEQm9Lq87LgD4GEsOK9h9tcwbuBqksOVTw= Received: by mx.zoho.eu with SMTPS id 1773594667541263.5769287920301; Sun, 15 Mar 2026 18:11:07 +0100 (CET) From: Josh Law To: Andrew Morton , Josh Law Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/7] lib/glob: treat trailing backslash as literal character Date: Sun, 15 Mar 2026 17:10:59 +0000 Message-Id: <20260315171104.268944-3-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260315171104.268944-1-objecting@objecting.org> References: <20260315171104.268944-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" A pattern ending with a lone backslash (e.g., "path\\") reads the NUL terminator as the escaped character, making the backslash effectively match end-of-string rather than a literal '\' character. This means glob_match("path\\", "path\\") would fail since the pattern consumes the NUL early, while glob_match("path\\", "path") would unexpectedly succeed. Guard the escape so that a trailing backslash keeps d =3D '\\' and falls through to literal matching, which is the intuitive behavior: a trailing backslash matches a literal backslash character. Signed-off-by: Josh Law --- lib/glob.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/glob.c b/lib/glob.c index cb45a9a47f28..df7f00619b1b 100644 --- a/lib/glob.c +++ b/lib/glob.c @@ -112,7 +112,8 @@ bool __pure glob_match(char const *pat, char const *str) } break; case '\\': - d =3D *pat++; + if (*pat !=3D '\0') + d =3D *pat++; fallthrough; default: /* Literal character */ literal: --=20 2.34.1