mirror of https://github.com/digint/btrbk
btrbk: allow directory traversal for subvol_args
parent
a25486336b
commit
047d3a1a65
7
btrbk
7
btrbk
|
@ -33,6 +33,7 @@ use Getopt::Long qw(GetOptions);
|
||||||
use Time::Local qw( timelocal timegm timegm_nocheck );
|
use Time::Local qw( timelocal timegm timegm_nocheck );
|
||||||
use IPC::Open3 qw(open3);
|
use IPC::Open3 qw(open3);
|
||||||
use Symbol qw(gensym);
|
use Symbol qw(gensym);
|
||||||
|
use Cwd qw(abs_path);
|
||||||
|
|
||||||
our $VERSION = '0.32.1-dev';
|
our $VERSION = '0.32.1-dev';
|
||||||
our $AUTHOR = 'Axel Burri <axel@tty0.ch>';
|
our $AUTHOR = 'Axel Burri <axel@tty0.ch>';
|
||||||
|
@ -5586,11 +5587,7 @@ MAIN:
|
||||||
foreach (@subvol_args) {
|
foreach (@subvol_args) {
|
||||||
my ($url_prefix, $path) = check_url($_);
|
my ($url_prefix, $path) = check_url($_);
|
||||||
if(!defined($path) && $subvol_args_allow_relative && ($url_prefix eq "") && (-d $_)) {
|
if(!defined($path) && $subvol_args_allow_relative && ($url_prefix eq "") && (-d $_)) {
|
||||||
unless(eval_quiet { require File::Spec; }) {
|
$path = check_file(abs_path($_), { absolute => 1, sanitize => 1 });
|
||||||
ERROR "Cannot handle relative paths (perl version too old; missing File::Spec module): $_";
|
|
||||||
exit 2;
|
|
||||||
}
|
|
||||||
$path = check_file(File::Spec->rel2abs($_), { absolute => 1 });
|
|
||||||
}
|
}
|
||||||
unless(defined($path)) {
|
unless(defined($path)) {
|
||||||
ERROR "Bad argument: not a subvolume declaration: $_";
|
ERROR "Bad argument: not a subvolume declaration: $_";
|
||||||
|
|
Loading…
Reference in New Issue