commit 4524fbe23f82662ab80107a430fc0384cd2230c7
parent a3c8bf22fb1e48b74bbe14ceb723a7f708470916
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Fri, 8 Oct 2021 10:14:58 +0300
Added missing update of connection's read buffer size
Diffstat:
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
@@ -3683,10 +3683,17 @@ MHD_connection_handle_read (struct MHD_Connection *connection)
#endif /* UPGRADE_SUPPORT */
default:
/* shrink read buffer to how much is actually used */
- MHD_pool_reallocate (connection->pool,
- connection->read_buffer,
- connection->read_buffer_size,
- connection->read_buffer_offset);
+ if ((0 != connection->read_buffer_size) &&
+ (connection->read_buffer_size != connection->read_buffer_offset))
+ {
+ mhd_assert (NULL != connection->read_buffer);
+ connection->read_buffer =
+ MHD_pool_reallocate (connection->pool,
+ connection->read_buffer,
+ connection->read_buffer_size,
+ connection->read_buffer_offset);
+ connection->read_buffer_size = connection->read_buffer_offset;
+ }
break;
}
return;