aboutsummaryrefslogtreecommitdiff
path: root/lib/lbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lbuf.c')
-rw-r--r--lib/lbuf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/lbuf.c b/lib/lbuf.c
index 48b6338..0ceadfd 100644
--- a/lib/lbuf.c
+++ b/lib/lbuf.c
@@ -122,9 +122,11 @@ _auth_lb_writelines (struct _line_buffer *s, const char *iptr, size_t isize,
{
char *start, *end;
- for (start = s->buffer, end = strchr (start, '\n');
+ for (start = s->buffer,
+ end = memchr (start, '\n', s->buffer + s->level - start);
end && end < s->buffer + s->level;
- start = end + 1, end = strchr (start, '\n'))
+ start = end + 1,
+ end = memchr (start, '\n', s->buffer + s->level - start))
if (end[-1] == '\r')
{
int rc = wr (data, start, end);
@@ -136,7 +138,7 @@ _auth_lb_writelines (struct _line_buffer *s, const char *iptr, size_t isize,
{
if (start < s->buffer + s->level)
{
- int rest = s->buffer + s->level - start + 1;
+ int rest = s->buffer + s->level - start;
memmove (s->buffer, start, rest);
s->level = rest;
}

Return to:

Send suggestions and report system problems to the System administrator.