From 047d3a1a65f11fa94a1661095c7295383ece50b3 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sat, 26 Feb 2022 18:09:42 +0100 Subject: [PATCH] btrbk: allow directory traversal for subvol_args --- btrbk | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/btrbk b/btrbk index d95fe9d..5366d3a 100755 --- a/btrbk +++ b/btrbk @@ -33,6 +33,7 @@ use Getopt::Long qw(GetOptions); use Time::Local qw( timelocal timegm timegm_nocheck ); use IPC::Open3 qw(open3); use Symbol qw(gensym); +use Cwd qw(abs_path); our $VERSION = '0.32.1-dev'; our $AUTHOR = 'Axel Burri '; @@ -5586,11 +5587,7 @@ MAIN: foreach (@subvol_args) { my ($url_prefix, $path) = check_url($_); if(!defined($path) && $subvol_args_allow_relative && ($url_prefix eq "") && (-d $_)) { - unless(eval_quiet { require File::Spec; }) { - ERROR "Cannot handle relative paths (perl version too old; missing File::Spec module): $_"; - exit 2; - } - $path = check_file(File::Spec->rel2abs($_), { absolute => 1 }); + $path = check_file(abs_path($_), { absolute => 1, sanitize => 1 }); } unless(defined($path)) { ERROR "Bad argument: not a subvolume declaration: $_";