summaryrefslogtreecommitdiff
path: root/archival/rpm2cpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/rpm2cpio.c')
-rw-r--r--archival/rpm2cpio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/archival/rpm2cpio.c b/archival/rpm2cpio.c
index e1e9398..9372dc5 100644
--- a/archival/rpm2cpio.c
+++ b/archival/rpm2cpio.c
@@ -70,6 +70,7 @@ extern int rpm2cpio_main(int argc, char **argv)
{
struct rpm_lead lead;
int rpm_fd;
+ unsigned char magic[2];
if (argc == 1) {
rpm_fd = fileno(stdin);
@@ -88,6 +89,11 @@ extern int rpm2cpio_main(int argc, char **argv)
/* Skip the main header */
skip_header(rpm_fd);
+
+ xread_all(rpm_fd, &magic, 2);
+ if ((magic[0] != 0x1f) || (magic[1] != 0x8b))
+ error_msg_and_die("Invalid gzip magic");
+ }
check_header_gzip(rpm_fd);
if (inflate(rpm_fd, fileno(stdout)) != 0) {