summaryrefslogtreecommitdiff
path: root/archival/libunarchive/check_header_gzip.c
diff options
context:
space:
mode:
authorGlenn L McGrath2002-09-27 06:46:02 +0000
committerGlenn L McGrath2002-09-27 06:46:02 +0000
commit2e41d0cb777e6af086b45555551780e02ad13f46 (patch)
treea53d807aeb25003e5a8ea22461079a10b5238e4d /archival/libunarchive/check_header_gzip.c
parenta47a3eada6ada1168205f6684e5c5a5c23d3558b (diff)
downloadbusybox-2e41d0cb777e6af086b45555551780e02ad13f46.zip
busybox-2e41d0cb777e6af086b45555551780e02ad13f46.tar.gz
Fix compress support and prevent a segfault
Diffstat (limited to 'archival/libunarchive/check_header_gzip.c')
-rw-r--r--archival/libunarchive/check_header_gzip.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/archival/libunarchive/check_header_gzip.c b/archival/libunarchive/check_header_gzip.c
index 508d309..e8bb8d5 100644
--- a/archival/libunarchive/check_header_gzip.c
+++ b/archival/libunarchive/check_header_gzip.c
@@ -5,9 +5,8 @@
extern void check_header_gzip(int src_fd)
{
union {
- unsigned char raw[10];
+ unsigned char raw[8];
struct {
- unsigned char magic[2];
unsigned char method;
unsigned char flags;
unsigned int mtime;
@@ -16,13 +15,7 @@ extern void check_header_gzip(int src_fd)
} formated;
} header;
- xread_all(src_fd, header.raw, 10);
-
- /* Magic header for gzip files, 1F 8B = \037\213 */
- if ((header.formated.magic[0] != 0x1F)
- || (header.formated.magic[1] != 0x8b)) {
- error_msg_and_die("Invalid gzip magic");
- }
+ xread_all(src_fd, header.raw, 8);
/* Check the compression method */
if (header.formated.method != 8) {