]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEBUG: buffer: check in __b_put_blk() whether the buffer room is respected
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Feb 2022 16:33:27 +0000 (17:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Feb 2022 16:33:27 +0000 (17:33 +0100)
This adds a BUG_ON() to make sure we don't face other situations like the
one fixed by previous commit.

include/haproxy/buf.h

index 78409c028fa4ea7e8b721e2bd73f4b3687013acc..de359f574312fcaf07bd189abf0a45a391722b51 100644 (file)
@@ -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;