(mu_hdrent_find_stream_pos): Check for
hrd->tail != NULL. (header_readline): Return immediately if header size is 0.
Showing
1 changed file
with
7 additions
and
2 deletions
... | @@ -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) | ... | ... |
-
Please register or sign in to post a comment