packages/net/haproxy/patches/0006-BUG-MEDIUM-buffer-Fix-the-wrapping-case-in-bo_putblk.patch
Christian Lachner 88fdeb5085 haproxy: Update MEDIUM+ patches for HAProxy v1.8.4
- Add new MEDIUM+ patches (see https://www.haproxy.org/bugs/bugs-1.8.4.html)
- Raise patch-level to 02

Signed-off-by: Christian Lachner <gladiac@gmail.com>
2018-03-16 11:26:28 +01:00

33 lines
1.1 KiB
Diff

From fefb8592821ff0fa56f435c581d6e92e563e7ad7 Mon Sep 17 00:00:00 2001
From: Christopher Faulet <cfaulet@haproxy.com>
Date: Mon, 26 Feb 2018 10:47:03 +0100
Subject: [PATCH] BUG/MEDIUM: buffer: Fix the wrapping case in bo_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 skip data copied during
the first memcpy.
This patch must be backported to 1.8, 1.7, 1.6 and 1.5.
(cherry picked from commit b2b279464c5c0f3dfadf02333e06eb0ae8ae8793)
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
include/common/buffer.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/common/buffer.h b/include/common/buffer.h
index 976085e..ae9aafd 100644
--- a/include/common/buffer.h
+++ b/include/common/buffer.h
@@ -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;
--
1.7.10.4