Commit c7f241fa authored by Ben Hutchings's avatar Ben Hutchings

unmkinitramfs: Unpack early and main cpio archives in separate directories

Otherwise this can probably be used to overwrite arbitrary files.
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 12744ebc
......@@ -72,7 +72,7 @@ splitinitramfs()
if [ $offset -ne 0 ]; then
# uncompressed archive
(
test -z "$dir" || { mkdir -p -- "$dir" && cd -- "$dir"; }
test -z "$dir" || { mkdir -p -- "$dir/early" && cd -- "$dir/early"; }
cpio -i "$@"
) < "$initramfs"
......@@ -81,7 +81,7 @@ splitinitramfs()
trap "rm -f '$subarchive'" EXIT
dd < "$initramfs" bs="$offset" skip=1 2> /dev/null \
> $subarchive
xcpio "$subarchive" "$dir" -i "$@"
xcpio "$subarchive" "$dir/main" -i "$@"
else
xcpio "$initramfs" "$dir" -i "$@"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment