libmakepkg: fix unsanitized source filenames

There were a couple places where filenames beginning with "-" were not
properly guarded against by passing them after "--". Some PKGBUILD
authors are crazy, but we still take those into account.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Eli Schwartz 2017-07-03 23:13:22 -04:00 committed by Allan McRae
parent 3c433abb54
commit 9c604af0a0

View file

@ -96,7 +96,7 @@ extract_file() {
fi
# do not rely on extension for file type
local file_type=$(file -bizL "$file")
local file_type=$(file -bizL -- "$file")
local ext=${file##*.}
local cmd=''
case "$file_type" in
@ -132,7 +132,7 @@ extract_file() {
$cmd -xf "$file" || ret=$?
else
rm -f -- "${file%.*}"
$cmd -dcf "$file" > "${file%.*}" || ret=$?
$cmd -dcf -- "$file" > "${file%.*}" || ret=$?
fi
if (( ret )); then
error "$(gettext "Failed to extract %s")" "$file"