mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-15 22:12:20 +00:00
tar: Prevent file buffering from reading uninitialized data
Regressed in 91fa10a0ab
.
This commit is contained in:
parent
7c32400431
commit
e2d71823d3
Notes:
sideshowbarker
2024-07-17 17:55:05 +09:00
Author: https://github.com/timschumi
Commit: e2d71823d3
Pull-request: https://github.com/SerenityOS/serenity/pull/12884
1 changed files with 3 additions and 2 deletions
|
@ -100,8 +100,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
int fd = TRY(Core::System::open(absolute_path, O_CREAT | O_WRONLY, header.mode()));
|
||||
|
||||
Array<u8, buffer_size> buffer;
|
||||
while (file_stream.read(buffer) > 0)
|
||||
TRY(Core::System::write(fd, buffer.span()));
|
||||
size_t bytes_read;
|
||||
while ((bytes_read = file_stream.read(buffer)) > 0)
|
||||
TRY(Core::System::write(fd, buffer.span().slice(0, bytes_read)));
|
||||
|
||||
TRY(Core::System::close(fd));
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue