From 063c25ad2428f08a14442d2bd208d6c83a37ef4b Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Tue, 17 Aug 2021 18:39:59 +0200 Subject: [PATCH] btrbk: add sanity checks on mountinfo list --- btrbk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/btrbk b/btrbk index 02315ca..6b6b88a 100755 --- a/btrbk +++ b/btrbk @@ -1940,6 +1940,10 @@ sub system_list_mountinfo($) non_destructive => 1, ); return undef unless(defined($ret)); + unless(@$ret) { + ERROR "Failed to parse \"$vol->{URL_PREFIX}$file\": no output"; + return undef; + } my @mountinfo; foreach(@$ret) @@ -1964,6 +1968,11 @@ sub system_list_mountinfo($) } my %line = %+; + unless(defined(check_file($line{mount_point}, { absolute => 1 }))) { + ERROR "Ambiguous mount point in \"$vol->{URL_PREFIX}$file\": $line{mount_point}"; + return undef; + } + # merge super_options and mount_options to MNTOPS. my %mntops; foreach (split(',', delete($line{super_options})),