Skip to content

Commit 8f25dc7

Browse files
committed
Escape source dataset name when mapping to destination path in znapzendztatz
The substitution that derives the destination dataset path interpolated $backupSet->{src} into a regex without quotemeta. ZFS dataset names may contain '.', which then matches any character, so the wrong prefix could be rewritten and statistics shown for the wrong destination. Wrap the source in \Q...\E, matching the already-correct form in ZnapZend.pm.
1 parent 234d055 commit 8f25dc7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

bin/znapzendztatz

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ sub main {
139139
}
140140
else{
141141
my $dstDataSet = $dataset;
142-
$dstDataSet =~ s/^$backupSet->{src}/$backupSet->{$key}/;
142+
$dstDataSet =~ s/^\Q$backupSet->{src}\E/$backupSet->{$key}/;
143143
dumpStats(collectData($backupSet->{src}, $key, $dstDataSet, $snapFilter), $opts->{H}, $opts->{setup});
144144
}
145145
}

0 commit comments

Comments
 (0)