(_auth_lb_writelines): Bugfix
Showing
1 changed file
with
5 additions
and
3 deletions
... | @@ -123,9 +123,11 @@ _auth_lb_writelines (struct _line_buffer *s, const char *iptr, size_t isize, | ... | @@ -123,9 +123,11 @@ _auth_lb_writelines (struct _line_buffer *s, const char *iptr, size_t isize, |
123 | { | 123 | { |
124 | char *start, *end; | 124 | char *start, *end; |
125 | 125 | ||
126 | for (start = s->buffer, end = strchr (start, '\n'); | 126 | for (start = s->buffer, |
127 | end = memchr (start, '\n', s->buffer + s->level - start); | ||
127 | end && end < s->buffer + s->level; | 128 | end && end < s->buffer + s->level; |
128 | start = end + 1, end = strchr (start, '\n')) | 129 | start = end + 1, |
130 | end = memchr (start, '\n', s->buffer + s->level - start)) | ||
129 | if (end[-1] == '\r') | 131 | if (end[-1] == '\r') |
130 | { | 132 | { |
131 | int rc = wr (data, start, end); | 133 | int rc = wr (data, start, end); |
... | @@ -137,7 +139,7 @@ _auth_lb_writelines (struct _line_buffer *s, const char *iptr, size_t isize, | ... | @@ -137,7 +139,7 @@ _auth_lb_writelines (struct _line_buffer *s, const char *iptr, size_t isize, |
137 | { | 139 | { |
138 | if (start < s->buffer + s->level) | 140 | if (start < s->buffer + s->level) |
139 | { | 141 | { |
140 | int rest = s->buffer + s->level - start + 1; | 142 | int rest = s->buffer + s->level - start; |
141 | memmove (s->buffer, start, rest); | 143 | memmove (s->buffer, start, rest); |
142 | s->level = rest; | 144 | s->level = rest; |
143 | } | 145 | } | ... | ... |
-
Please register or sign in to post a comment