The length of the extra field was not correctly determined, and the

offset was not changed correctly either: the order in which the
expression was evaluated was undefined; in fact, GCC 2.95.3 would use
the same buffer[index] twice.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19060 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-10-13 12:10:03 +00:00
parent f5fc6356c4
commit d0d30c36ca

View File

@ -154,16 +154,14 @@ skip_gzip_header(z_stream *stream)
if (buffer[0] != 0x1f || buffer[1] != 0x8b)
return false;
uint32 offset = 3;
// we need the flags field to determine the length of the header
int flags = buffer[offset++];
int flags = buffer[3];
offset += 6;
uint32 offset = 10;
if ((flags & 0x04) != 0) {
// skip extra field
offset += buffer[offset++] | (buffer[offset++] << 8);
offset += (buffer[offset] | (buffer[offset + 1] << 8)) + 2;
if (offset >= stream->avail_in)
return false;
}