Skip to content

Commit

Permalink
rpm2cpio.sh: Check for header magic
Browse files Browse the repository at this point in the history
This make is much less likely to mistake a file as an RPM and will catch
errors in header size calculation.
  • Loading branch information
ffesti authored and dmnks committed Jul 13, 2022
1 parent 4420c78 commit ba31a14
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/rpm2cpio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ _dd() {
}

calcsize() {

case "$(_dd $1 bs=4 count=1 | tr -d '\0')" in
"$(printf '\216\255\350')"*) ;; # '\x8e\xad\xe8'
*) fatal "File doesn't look like rpm: $pkg" ;;
esac

offset=$(($1 + 8))

local i b b0 b1 b2 b3 b4 b5 b6 b7
Expand Down

0 comments on commit ba31a14

Please sign in to comment.