From 1df00237ae36da1debd5f30ca76a78e28a10d6e2 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 25 May 2026 18:32:15 +0300 Subject: [PATCH] xzgrep: Fix handling of the ' char at the end of an option For example, the following would run the "id" command: xzgrep "--a='" "--b=;id;'" "pattern" foo.xz The bug was inherited from gzip's zgrep. It was reported to bug-gzip by Leenear. It was fixed in gzip in the commit cd74dc30f8cc by Paul Eggert. Link: https://lists.gnu.org/archive/html/bug-gzip/2026-04/msg00032.html --- src/scripts/xzgrep.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/xzgrep.in b/src/scripts/xzgrep.in index 511ea39c..46205512 100644 --- a/src/scripts/xzgrep.in +++ b/src/scripts/xzgrep.in @@ -147,7 +147,7 @@ while test $# -ne 0; do esac case $option in - (*\'?*) + (*\'*) option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");; (*) option="'$option'";;