From 1d6ed690232de70c522226315b8b5a0e5c1706c1 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 10 May 2014 18:12:10 +0200 Subject: reencryption: Properly escape input to sed --- src/password-store.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/password-store.sh b/src/password-store.sh index 65283b8..7ef58bd 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -103,7 +103,7 @@ reencrypt_path() { set_gpg_recipients "$passfile_dir" if [[ $prev_gpg_recipients != "${GPG_RECIPIENTS[*]}" ]]; then for index in "${!GPG_RECIPIENTS[@]}"; do - local group="$(sed -n "s/^cfg:group:${GPG_RECIPIENTS[$index]}:\\(.*\\)\$/\\1/p" <<<"$groups" | head -n 1)" + local group="$(sed -n "s/^cfg:group:$(sed 's/[\/&]/\\&/g' <<<"${GPG_RECIPIENTS[$index]}"):\\(.*\\)\$/\\1/p" <<<"$groups" | head -n 1)" [[ -z $group ]] && continue IFS=";" eval 'GPG_RECIPIENTS+=( $group )' # http://unix.stackexchange.com/a/92190 unset GPG_RECIPIENTS[$index] -- cgit v1.2.3