mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-27 01:56:21 +00:00
LibWeb: Account for header size when reading MessagePort message payload
Previously, the fact that this wasn't accounted for could lead to a crash when large messages were received.
This commit is contained in:
committed by
Andreas Kling
parent
f735c464d3
commit
34e465a67e
@@ -279,7 +279,7 @@ ErrorOr<MessagePort::ParseDecision> MessagePort::parse_message()
|
||||
[[fallthrough]];
|
||||
}
|
||||
case SocketState::Data: {
|
||||
if (num_bytes_ready < m_socket_incoming_message_size)
|
||||
if (num_bytes_ready < HEADER_SIZE + m_socket_incoming_message_size)
|
||||
return ParseDecision::NotEnoughData;
|
||||
|
||||
auto payload = m_buffered_data.span().slice(HEADER_SIZE, m_socket_incoming_message_size);
|
||||
|
||||
Reference in New Issue
Block a user