From cc9fda4d36f3ae5427fa05564a4bdd5b53e94ce5 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 19 Mar 2015 23:34:11 +0100 Subject: Fix potential issue when filling placeholders. (e.g., if $h contains '%i' we don't want to fill it again; '%%s' should expand to '%s' not '$s') --- icevault | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/icevault b/icevault index 07a03a8..40eaf4b 100755 --- a/icevault +++ b/icevault @@ -256,9 +256,11 @@ sub getIdentityFile($) { my ($s, $h, $i) = ($1, $2, $3); my $file = $CONFIG{store}; - $file =~ s/%s/$s/g; - $file =~ s/%h/$h/g; - $file =~ s/%i/$i/g; + $file =~ s{\%(.)}{ $1 eq '%' ? '%' : + $1 eq 's' ? $s : + $1 eq 'h' ? $h : + $1 eq 'i' ? $i : + die "Invalid placeholder %$1" }ge; return $file; } -- cgit v1.2.3