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.
This commit is contained in:
Christopher Faulet 2019-05-07 10:52:25 +02:00
parent 39593e6ae3
commit cc5060217e

View File

@ -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;