In realpath(), make sure each path component consists only of safe
characters, and untaint it.
This commit is contained in:
parent
614232077b
commit
8b4c82b30e
@ -91,7 +91,9 @@ sub realpath($;$) {
|
||||
or die("unable to resolve symlink '$realpath/$part': $!\n");
|
||||
$realpath = realpath($target, $realpath);
|
||||
} else {
|
||||
$realpath .= "/$part";
|
||||
$part =~ m/^([\w.-]+)$/
|
||||
or die("unsafe path '$realpath/$part'\n");
|
||||
$realpath .= "/$1";
|
||||
}
|
||||
}
|
||||
return $realpath;
|
||||
|
Loading…
Reference in New Issue
Block a user