diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-04-02 12:33:15 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-03 15:53:49 +0200 |
commit | f7960ffbe3b3d686afb0982608818c5341fe057b (patch) | |
tree | 3e7eeb66cc7b0ba5cb20683c0f3c782865aa0710 /AK/Span.h | |
parent | cb0c8634d4effe4bee864c09edf59681c8a8c7b1 (diff) | |
download | serenity-f7960ffbe3b3d686afb0982608818c5341fe057b.zip |
AK: Prevent passing lengths greater than 256 to getentropy()
From the getentropy() man page, "The maximum permitted value for the
length argument is 256". Several of our tests were passing lengths of
several thousand bytes, causing getentropy() to fail with EIO, which we
were completely ignoring. This caused these tests to only test long
sequences of 0x00.
We now loop over the provided buffer to fill it 256 bytes at a time. If
getentropy() fails for any reason, we fall back to the default method of
filling it with one random byte at a time.
Diffstat (limited to 'AK/Span.h')
0 files changed, 0 insertions, 0 deletions