1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Fix segfault if $PATH contains a .paths directory (#55)

ksh crashed if it encountered a .paths directory in any of the
directories in $PATH.

Ref: 1534855

src/cmd/ksh93/sh/path.c: path_chkpaths():
- Refuse to read .paths if it's not a regular file
  or a symlink to a regular file.
This commit is contained in:
Anuradha Weeraman 2020-07-02 18:29:07 -04:00 committed by GitHub
parent 0c40e7c182
commit 035a4cb3f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 1 deletions

View file

@ -408,6 +408,15 @@ END
v=$(PATH=/dev/null "$SHELL" -c 'command -p ls /dev/null')
[[ $v == /dev/null ]] || err_exit 'command -p fails to find standard utility'
# ksh segfaults if $PATH contains a .paths directory
mkdir -p $tmp/paths-dir-crash/
cat > $tmp/paths-dir-crash/run.sh <<- EOF
mkdir -p $tmp/paths-dir-crash/.paths
export PATH=$tmp/paths-dir-crash:$PATH
print ok
EOF
[[ $($SHELL $tmp/paths-dir-crash/run.sh 2>/dev/null) == ok ]] || err_exit "ksh crashes if PATH contains a .paths directory"
# ======
exit $((Errors<125?Errors:125))