Commit 58c88768 58c8876817cfb60c02351eae4d1a2721c58f27b6 by Sergey Poznyakoff

(mu_hdrent_find_stream_pos): Check for

hrd->tail != NULL.
(header_readline): Return immediately if header size is 0.
1 parent 6427c5b5
......@@ -111,7 +111,7 @@ mu_hdrent_find_stream_pos (struct _mu_header *hdr, mu_off_t pos,
}
x += strsize;
}
if (x == pos)
if (x == pos && hdr->tail)
{
/* To supply the trailing '\n' */
p = hdr->tail;
......@@ -1048,7 +1048,12 @@ header_readline (mu_stream_t is, char *buffer, size_t buflen,
status = mu_header_fill (header);
if (status)
return status;
if (header->size == 0)
{
if (pnread)
*pnread = 0;
return 0;
}
if (mu_hdrent_find_stream_pos (header, off, &ent, &ent_off))
{
if (pnread)
......