]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: buffer: Fix the wrapping case in bi_putblk
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 26 Feb 2018 09:51:28 +0000 (10:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 27 Feb 2018 14:45:03 +0000 (15:45 +0100)
When the block of data need to be split to support the wrapping, the start of
the second block of data was wrong. We must be sure to skup data copied during
the first memcpy.

This patch must be backported to 1.8.

include/common/buffer.h

index 4adfdc6471c6d4ad59a69d7a3098d4359da7aa8e..7ac98bf0d527b539e31a6394cd69a500e906a6d8 100644 (file)
@@ -577,7 +577,7 @@ static inline int bi_putblk(struct buffer *b, const char *blk, int len)
 
        memcpy(bi_end(b), blk, half);
        if (len > half)
-               memcpy(b_ptr(b, b->i + half), blk, len - half);
+               memcpy(b_ptr(b, b->i + half), blk + half, len - half);
        b->i += len;
        return len;
 }