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, ...@@ -111,7 +111,7 @@ mu_hdrent_find_stream_pos (struct _mu_header *hdr, mu_off_t pos,
111 } 111 }
112 x += strsize; 112 x += strsize;
113 } 113 }
114 if (x == pos) 114 if (x == pos && hdr->tail)
115 { 115 {
116 /* To supply the trailing '\n' */ 116 /* To supply the trailing '\n' */
117 p = hdr->tail; 117 p = hdr->tail;
...@@ -1048,7 +1048,12 @@ header_readline (mu_stream_t is, char *buffer, size_t buflen, ...@@ -1048,7 +1048,12 @@ header_readline (mu_stream_t is, char *buffer, size_t buflen,
1048 status = mu_header_fill (header); 1048 status = mu_header_fill (header);
1049 if (status) 1049 if (status)
1050 return status; 1050 return status;
1051 1051 if (header->size == 0)
1052 {
1053 if (pnread)
1054 *pnread = 0;
1055 return 0;
1056 }
1052 if (mu_hdrent_find_stream_pos (header, off, &ent, &ent_off)) 1057 if (mu_hdrent_find_stream_pos (header, off, &ent, &ent_off))
1053 { 1058 {
1054 if (pnread) 1059 if (pnread)
......