summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-07-30 12:27:03 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-07-30 12:27:03 +0000
commit0190dfaf8f63b056f4f2e83ea119c276ed2df42a (patch)
treef5562b0ef35641ab9471ebd775a32c1049242b0f
parentf43f6d312b52702ce8020477960ab0521018b745 (diff)
downloadabuild-0190dfaf8f63b056f4f2e83ea119c276ed2df42a.tar.bz2
abuild-0190dfaf8f63b056f4f2e83ea119c276ed2df42a.tar.xz
abuild: add safety check so we dont scan elfs outside our pkgdir
this is to catch bugs in abuild itself early
-rwxr-xr-xabuild.in10
1 files changed, 9 insertions, 1 deletions
diff --git a/abuild.in b/abuild.in
index 51b4a6a..ad1adc2 100755
--- a/abuild.in
+++ b/abuild.in
@@ -1039,13 +1039,21 @@ find_scanelf_paths() {
scan_shared_objects() {
local name="$1" controldir="$2" datadir="$3"
- local opt=
+ local opt= i=
# allow spaces in paths
IFS=:
set -- $(find_scanelf_paths "$datadir")
unset IFS
+ # sanity check, verify that each path is prefixed with datadir
+ for i; do
+ if [ "${i#$datadir}" = "$i" ]; then
+ error "Internal error in scanelf paths"
+ return 1
+ fi
+ done
+
if options_has "ldpath-recursive"; then
opt="--recursive"
fi