From cc5060217e5b88152e22ee26b1c1fe083f357107 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 7 May 2019 10:52:25 +0200 Subject: [PATCH] BUG/MINOR: htx: Never transfer more than expected in htx_xfer_blks() When the maximum free space available for data in the HTX message is compared to the number of bytes to transfer, we must take into account the amount of data already transferred. Otherwise we may move more data than expected. This patch must be backported to 1.9. --- src/htx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/htx.c b/src/htx.c index b18ce5f67..a98a3080c 100644 --- a/src/htx.c +++ b/src/htx.c @@ -516,8 +516,8 @@ struct htx_ret htx_xfer_blks(struct htx *dst, struct htx *src, uint32_t count, info = blk->info; max = htx_free_data_space(dst); - if (max > count) - max = count; + if (max > count - ret) + max = count - ret; if (sz > max) { sz = max; info = (type << 28) + sz;