diff --git a/include/common/buf.h b/include/common/buf.h index 96472622ec..a1355e653e 100644 --- a/include/common/buf.h +++ b/include/common/buf.h @@ -494,6 +494,9 @@ static inline void __b_putblk(struct buffer *b, const char *blk, size_t len) { size_t half = b_contig_space(b); + if (half > len) + half = len; + memcpy(b_tail(b), blk, half); if (len > half)