mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +00:00
LibProtocol: Fix crash on EOF when using Request::stream_into
`Request::stream_into_impl` would call `stream.write_or_error` with a zero length buffer when EOF was reached. However, the `Core::Stream::Stream::write_or_error` implementation verifies that the buffer lenght is non-zero, resulting in a crash. With this change the zero length buffer is never written to the stream.
This commit is contained in:
parent
7070713ec8
commit
45004022ad
1 changed files with 2 additions and 2 deletions
|
@ -52,12 +52,12 @@ void Request::stream_into_impl(T& stream)
|
||||||
if (result.is_error())
|
if (result.is_error())
|
||||||
continue;
|
continue;
|
||||||
auto nread = result.value();
|
auto nread = result.value();
|
||||||
|
if (nread == 0)
|
||||||
|
break;
|
||||||
if (!stream.write_or_error({ buf, nread })) {
|
if (!stream.write_or_error({ buf, nread })) {
|
||||||
// FIXME: What do we do here?
|
// FIXME: What do we do here?
|
||||||
TODO();
|
TODO();
|
||||||
}
|
}
|
||||||
if (nread == 0)
|
|
||||||
break;
|
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
if (m_internal_stream_data->read_stream->is_eof() && m_internal_stream_data->request_done) {
|
if (m_internal_stream_data->read_stream->is_eof() && m_internal_stream_data->request_done) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue