]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: buffer: Fix the wrapping case in bo_putblk
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 26 Feb 2018 09:47:03 +0000 (10:47 +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 skip data copied during
the first memcpy.

This patch must be backported to 1.8, 1.7, 1.6 and 1.5.

include/common/buffer.h

index c920298368871912ab1c9bbef29518026e619943..4adfdc6471c6d4ad59a69d7a3098d4359da7aa8e 100644 (file)
@@ -468,7 +468,7 @@ static inline int bo_putblk(struct buffer *b, const char *blk, int len)
        memcpy(b->p, blk, half);
        b->p = b_ptr(b, half);
        if (len > half) {
-               memcpy(b->p, blk, len - half);
+               memcpy(b->p, blk + half, len - half);
                b->p = b_ptr(b, half);
        }
        b->o += len;