Skip to content
Snippets Groups Projects
Commit db7aea1e authored by David Goulet's avatar David Goulet
Browse files

istream: Request the minimal HEADER_SIZE and not MAGIC_SIZE


When looking at the header in an istream source, request from the parent
the HEADER_SIZE which contains the magic value and the version.

Else, it is possible to only have the MAGIC_SIZE and thus failing to
read the version.

This has been observed on Riseup email infrastructure leading to a
Permission denied to open the mbox because of the unknown version:

Error: [trees] Unknown version 0. Supporting 1 to 1

Signed-off-by: default avatarDavid Goulet <dgoulet@riseup.net>
parent 2ac49852
Branches
Tags
No related merge requests found
......@@ -138,7 +138,7 @@ trees_istream_read_detect(struct trees_istream *sstream)
i_stream_set_max_buffer_size(sstream->istream.parent,
MAX_ISTREAM_BUFFER_SIZE);
result = trees_istream_read_parent(sstream, MAGIC_SIZE, 0);
result = trees_istream_read_parent(sstream, HEADER_SIZE, 0);
if (result <= 0) {
/* Make sure we return an error here. */
result = -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment