unzip concatenated gzip files
Denys Vlasenko
vda.linux at googlemail.com
Thu Oct 4 12:31:03 UTC 2007
Hi,
Sorry for the delay.
On Tuesday 02 October 2007 13:17, Loïc Grenié wrote:
> This patch tries to allow the unzipping of concatenated gzip files.
union {
unsigned char raw[8];
struct {
unsigned char gz_method;
unsigned char flags;
unsigned int mtime;
unsigned char xtra_flags;
unsigned char os_flags;
} formatted;
} header;
sizeof(header) == 12.
Hmm. Did you code internal_check_header_gzip by copy-pasting
check_header_gzip_or_die?
/* Discard original name or file comment if any */
/* Discard file comment if any */
if (header.formatted.flags & 0x18) {
bool comm = 0;
/* bit 3 set: original file name present */
/* bit 4 set: file comment present */
read_string:
do {
if (top_up(PASS_STATE 1))
return -1;
}
while (bytebuffer[bytebuffer_offset++] != 0);
What guarantees that you don't go far beyond bytebuffer's end?
Aha. I see. It's a do {} while written in an obfuscated way.
if (comm == 0 && (header.formatted.flags & 0x18) == 0x18) {
comm = 1;
goto read_string;
}
}
I will try to integrate it later this week/weekend.
Loic, please submit future patches this way:
* Patches split into parts:
* cleanups first (unneeded statements commented out, etc)
* real code changes next
* follow existing code's style:
if () {
...
}
do {
} while
instead of
if ()
{
...
}
do {
}
while
--
vda
More information about the busybox
mailing list