mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Fix kernel crash in get_dir_entries when buffer too small.
Before e06362de9487806df92cf2360a42d3eed905b6bf this was a sneaky buffer overflow. BufferStream did not do range checking and continued to write past the allocated buffer (the size of which was controlled by the user.) The issue surfaced after my changes because OutputMemoryStream does range checking. Not sure how exploitable that bug was, directory entries are somewhat controllable by the user but the buffer was on the heap, so exploiting that should be tough.
This commit is contained in:
parent
f69281573e
commit
0579a2db34
Notes:
sideshowbarker
2024-07-19 02:23:07 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/0579a2db34c Pull-request: https://github.com/SerenityOS/serenity/pull/3507
1 changed files with 1 additions and 1 deletions
|
@ -191,7 +191,7 @@ ssize_t FileDescription::get_dir_entries(UserOrKernelBuffer& buffer, ssize_t siz
|
|||
if (result.is_error())
|
||||
return result;
|
||||
|
||||
if (static_cast<size_t>(size) < stream.size())
|
||||
if (stream.handle_recoverable_error())
|
||||
return -EINVAL;
|
||||
|
||||
if (!buffer.write(stream.bytes()))
|
||||
|
|
Loading…
Reference in a new issue