Skip to content

Commit 34a4a67

Browse files
committed
Secure the shebangs pruning
1 parent 6e1c8cc commit 34a4a67

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

linuxdeploy-plugin-python.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ done
161161
cd "$APPDIR/${prefix}/bin"
162162
for exe in $(ls "${APPDIR}/${prefix}/bin"*)
163163
do
164-
sed -i '1s|^#!.*\(python[0-9.]*\)|#!/bin/sh\n"exec" "$(dirname $(readlink -f $\{0\}))/../../bin/\1" "$0" "$@"|' "$exe"
164+
if [[ -f "$exe" ]] && [[ -x "$exe" ]]; then
165+
sed -i '1s|^#!.*\(python[0-9.]*\)|#!/bin/sh\n"exec" "$(dirname $(readlink -f $\{0\}))/../../bin/\1" "$0" "$@"|' "$exe"
166+
fi
165167
done
166168

167169

0 commit comments

Comments
 (0)