From: Christopher Faulet Date: Mon, 6 Aug 2018 13:43:12 +0000 (+0200) Subject: BUG/MINOR: buffers: Fix b_slow_realign when a buffer is realign without output X-Git-Tag: v1.9-dev2~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad4e1a4735a58878d0a50125b60eb801903f7be1;p=thirdparty%2Fhaproxy.git 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 . --- diff --git a/include/common/buf.h b/include/common/buf.h index 6d46111125..96472622ec 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