1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21:25:07 +00:00

Net: use KBuffer::capacity() when checking if we can reuse buffer

This commit is contained in:
Adam Sandberg Ericsson 2020-11-16 20:15:47 +00:00 committed by Andreas Kling
parent 69a30f95cc
commit 477e13f6c5

View file

@ -185,7 +185,7 @@ void NetworkAdapter::did_receive(ReadonlyBytes payload)
} else {
buffer = m_unused_packet_buffers.take_first();
--m_unused_packet_buffers_count;
if (payload.size() <= buffer.value().size()) {
if (payload.size() <= buffer.value().capacity()) {
memcpy(buffer.value().data(), payload.data(), payload.size());
buffer.value().set_size(payload.size());
} else {