From 96eb6e4df8718e7085589b8521603ed42ae8bf18 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 3 Jun 2020 10:51:58 +0100 Subject: [PATCH] scripts: Don't add an empty entry to LD_LIBRARY_PATH LD_LIBRARY_PATH="/path/to/lib:" is interpreted as equivalent to LD_LIBRARY_PATH="/path/to/lib:.", loading libraries from the current working directory, which could lead to malicious libraries being loaded if the current working directory is untrusted. To avoid this, only add the current LD_LIBRARY_PATH to the new LD_LIBRARY_PATH if it is actually set. This commit also single-quotes the interpolated @VARIABLES@ so that their values can contain shell special characters (other than single quotes). Signed-off-by: Simon McVittie --- pipewire-jack/src/pw-jack.in | 2 +- pipewire-pulseaudio/src/pw-pulse.in | 2 +- pw-uninstalled.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pipewire-jack/src/pw-jack.in b/pipewire-jack/src/pw-jack.in index 555d4d886..2ff590c94 100755 --- a/pipewire-jack/src/pw-jack.in +++ b/pipewire-jack/src/pw-jack.in @@ -53,7 +53,7 @@ done shift $(( $OPTIND - 1 )) -LD_LIBRARY_PATH=@LIBJACK_PATH@:$LD_LIBRARY_PATH +LD_LIBRARY_PATH='@LIBJACK_PATH@'"${LD_LIBRARY_PATH+":$LD_LIBRARY_PATH"}" export LD_LIBRARY_PATH exec "$@" diff --git a/pipewire-pulseaudio/src/pw-pulse.in b/pipewire-pulseaudio/src/pw-pulse.in index 72ff62f55..a8c470bba 100755 --- a/pipewire-pulseaudio/src/pw-pulse.in +++ b/pipewire-pulseaudio/src/pw-pulse.in @@ -53,7 +53,7 @@ done shift $(( $OPTIND - 1 )) -LD_LIBRARY_PATH=@LIBPULSE_PATH@:$LD_LIBRARY_PATH +LD_LIBRARY_PATH='@LIBPULSE_PATH@'"${LD_LIBRARY_PATH+":$LD_LIBRARY_PATH"}" export LD_LIBRARY_PATH exec "$@" diff --git a/pw-uninstalled.sh b/pw-uninstalled.sh index c1af6bbcd..0ed106caf 100755 --- a/pw-uninstalled.sh +++ b/pw-uninstalled.sh @@ -35,8 +35,8 @@ export PIPEWIRE_CONFIG_FILE="${BUILDDIR}/src/daemon/pipewire.conf" export SPA_PLUGIN_DIR="${BUILDDIR}/spa/plugins" export PIPEWIRE_MODULE_DIR="${BUILDDIR}/src/modules" export PATH="${BUILDDIR}/src/daemon:${BUILDDIR}/src/tools:${BUILDDIR}/src/examples:${PATH}" -export LD_LIBRARY_PATH="${BUILDDIR}/pipewire-pulseaudio/src/:${BUILDDIR}/src/pipewire/:${BUILDDIR}/pipewire-jack/src/:${LD_LIBRARY_PATH}" -export GST_PLUGIN_PATH="${BUILDDIR}/src/gst/:${GST_PLUGIN_PATH}" +export LD_LIBRARY_PATH="${BUILDDIR}/pipewire-pulseaudio/src/:${BUILDDIR}/src/pipewire/:${BUILDDIR}/pipewire-jack/src/${LD_LIBRARY_PATH+":$LD_LIBRARY_PATH"}" +export GST_PLUGIN_PATH="${BUILDDIR}/src/gst/${GST_PLUGIN_PATH+":${GST_PLUGIN_PATH}"}" # FIXME: find a nice, shell-neutral way to specify a prompt ${SHELL}