mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 08:39:22 +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:
parent
f735c464d3
commit
34e465a67e
Notes:
github-actions[bot]
2024-08-01 09:41:31 +00:00
Author: https://github.com/tcl3
Commit: 34e465a67e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/906
1 changed files with 1 additions and 1 deletions
|
@ -279,7 +279,7 @@ ErrorOr<MessagePort::ParseDecision> MessagePort::parse_message()
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
case SocketState::Data: {
|
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;
|
return ParseDecision::NotEnoughData;
|
||||||
|
|
||||||
auto payload = m_buffered_data.span().slice(HEADER_SIZE, m_socket_incoming_message_size);
|
auto payload = m_buffered_data.span().slice(HEADER_SIZE, m_socket_incoming_message_size);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue