make sure absolute package paths start with a slash and are readable files

This commit is contained in:
Johannes Schauer Marin Rodrigues 2022-12-22 10:15:27 +01:00
parent 2fd3d768e8
commit 0dfd9adf2b
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -4363,9 +4363,15 @@ sub main() {
if (!defined $pkg) { if (!defined $pkg) {
error "cannot resolve absolute path of $pkg: $!"; error "cannot resolve absolute path of $pkg: $!";
} }
if ($pkg !~ /^\//) {
error "absolute path of $pkg doesn't start with a slash";
}
if (!-f $pkg) { if (!-f $pkg) {
error "$pkg is not an existing file"; error "$pkg is not an existing file";
} }
if (!-r $pkg) {
error "$pkg is not readable";
}
return $pkg; return $pkg;
}; };
if ($opt_value =~ /^[?~!(]/) { if ($opt_value =~ /^[?~!(]/) {