From: Willy Tarreau Date: Fri, 18 Feb 2022 16:33:27 +0000 (+0100) Subject: DEBUG: buffer: check in __b_put_blk() whether the buffer room is respected X-Git-Tag: v2.6-dev2~106 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d439a496550ba44ceae09a59c72c278163ff8b99;p=thirdparty%2Fhaproxy.git DEBUG: buffer: check in __b_put_blk() whether the buffer room is respected This adds a BUG_ON() to make sure we don't face other situations like the one fixed by previous commit. --- diff --git a/include/haproxy/buf.h b/include/haproxy/buf.h index 78409c028f..de359f5743 100644 --- a/include/haproxy/buf.h +++ b/include/haproxy/buf.h @@ -519,6 +519,8 @@ static inline void __b_putblk(struct buffer *b, const char *blk, size_t len) { size_t half = b_contig_space(b); + BUG_ON(b_data(b) + len > b_size(b)); + if (half > len) half = len;