diff options
| author | Guilhem Moulin <guilhem@fripost.org> | 2015-03-19 23:34:11 +0100 | 
|---|---|---|
| committer | Guilhem Moulin <guilhem@fripost.org> | 2015-03-19 23:34:14 +0100 | 
| commit | cc9fda4d36f3ae5427fa05564a4bdd5b53e94ce5 (patch) | |
| tree | 2399ca60108544a618a646d350bc6f37741e048b | |
| parent | 867c4d4095f9bdb2ad1e6f283ff66827e5199d86 (diff) | |
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')
| -rwxr-xr-x | icevault | 8 | 
1 files changed, 5 insertions, 3 deletions
| @@ -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;  } | 
