Are you sure that this is correct?
Code:
int ExpandZlibArchiveType0( ZLIB *zlib )
{
STREAM *Stream = zlib->Stream;
BUFFER *Into = GrabBuffer( zlib->Buffers, zlib->Into );
uchar *into = Into->addr;
uint leng = StreamBits( Stream, 16, true );
FlipBits( &leng, 16 );
Stream->have = Stream->used + (leng * 8);
while ( Stream->used < Stream->have )
into[Into->used++] = (uchar)StreamBits( Stream, 8, true );
return 0;
}
It might pay to run some test data though it and verify... here's the section of the RFC:
Code:
3.2.4. Non-compressed blocks (BTYPE=00)
Any bits of input up to the next byte boundary are ignored.
The rest of the block consists of the following information:
0 1 2 3 4...
+---+---+---+---+================================+
| LEN | NLEN |... LEN bytes of literal data...|
+---+---+---+---+================================+
LEN is the number of data bytes in the block. NLEN is the
one's complement of LEN.