From ad4e1a4735a58878d0a50125b60eb801903f7be1 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 6 Aug 2018 15:43:12 +0200 Subject: [PATCH] BUG/MINOR: buffers: Fix b_slow_realign when a buffer is realign without output When b_slow_realign is called with the parameter equal to 0, the buffer's head, after the realign, must be set to 0. It was errornously set to the buffer's size, because there was no test on the value of . --- include/common/buf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common/buf.h b/include/common/buf.h index 6d4611112..96472622e 100644 --- a/include/common/buf.h +++ b/include/common/buf.h @@ -472,7 +472,7 @@ static inline void b_slow_realign(struct buffer *b, char *swap, size_t output) memcpy(b_orig(b), swap, b_data(b) - output); memcpy(b_wrap(b) - output, swap + b_size(b) - output, output); - b->head = b_size(b) - output; + b->head = (output ? b_size(b) - output : 0); } /* b_putchar() : tries to append char at the end of buffer . Supports