modules/programs: sane-sandboxed: fix normPath handling of paths containing special characters like [

This commit is contained in:
2024-02-19 15:32:23 +00:00
parent de297f22be
commit 34dedcff57

View File

@@ -91,7 +91,8 @@ normPath() {
# and we push nothing to _npComps, # and we push nothing to _npComps,
# but we're guaranteed to make progress. # but we're guaranteed to make progress.
_npThisComp="${_npUnparsed%%/*}" _npThisComp="${_npUnparsed%%/*}"
_npUnparsed="${_npUnparsed/$_npThisComp}" _npThisLen="${#_npThisComp}"
_npUnparsed="${_npUnparsed:$_npThisLen}"
if [ "$_npThisComp" = ".." ]; then if [ "$_npThisComp" = ".." ]; then
# "go up" path component => delete the leaf dir (if any) # "go up" path component => delete the leaf dir (if any)
if [ ${#_npComps[@]} -ne 0 ]; then if [ ${#_npComps[@]} -ne 0 ]; then