We requested too few bytes from istream, so there wasn't any guarantee that
the istream actually had all the bytes. This caused a problem for example
with mdbox when the previous mail was already fetched and the stream happened
to end in the middle of the lz4 header.
const unsigned char *data;
size_t size;
- if (i_stream_read_data(input, &data, &size, 6 - 1) <= 0)
+ if (i_stream_read_data(input, &data, &size,
+ IOSTREAM_LZ4_MAGIC_LEN - 1) <= 0)
return FALSE;
/* there is no standard LZ4 header, so we've created our own */
return memcmp(data, IOSTREAM_LZ4_MAGIC, IOSTREAM_LZ4_MAGIC_LEN) == 0;