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