1
0
mirror of https://git.tukaani.org/xz.git synced 2026-10-31 11:24:56 +00:00

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
This commit is contained in:
Lasse Collin 2026-05-25 18:32:15 +03:00
parent 2928248922
commit 1df00237ae
No known key found for this signature in database
GPG Key ID: 38EE757D69184620

View File

@ -147,7 +147,7 @@ while test $# -ne 0; do
esac esac
case $option in case $option in
(*\'?*) (*\'*)
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");; option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
(*) (*)
option="'$option'";; option="'$option'";;