From: Christopher Faulet Date: Mon, 26 Feb 2018 09:51:28 +0000 (+0100) Subject: BUG/MEDIUM: buffer: Fix the wrapping case in bi_putblk X-Git-Tag: v1.9-dev1~402 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca6ef506610e9d78f99b7ab2095ce0f8a47e18df;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: buffer: Fix the wrapping case in bi_putblk 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. --- diff --git a/include/common/buffer.h b/include/common/buffer.h index 4adfdc6471..7ac98bf0d5 100644 --- a/include/common/buffer.h +++ b/include/common/buffer.h @@ -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; }