]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
xzgrep: Fix handling of the ' char at the end of an option
authorLasse Collin <lasse.collin@tukaani.org>
Mon, 25 May 2026 15:32:15 +0000 (18:32 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 27 May 2026 10:00:11 +0000 (13:00 +0300)
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

index 511ea39c7fd6eed452372ad2fa54fd01444b0835..462055120c3d8a6c104346a08b43deee349b8d6a 100644 (file)
@@ -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'";;