diff options
author | Jean-Baptiste Boric <jblbeurope@gmail.com> | 2021-05-14 17:17:26 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-14 22:24:02 +0200 |
commit | 5a0468c21f676297aac8e97e348c6287e31653f7 (patch) | |
tree | b5fdad48058464dbcefd124b1a0a452fd60fee66 /Userland/Services/LookupServer | |
parent | 069bf988ed990f68b1f13fb5a63d674f4529cfb4 (diff) | |
download | serenity-5a0468c21f676297aac8e97e348c6287e31653f7.zip |
Userland: Migrate from arc4random_uniform() to get_random_uniform()
Diffstat (limited to 'Userland/Services/LookupServer')
-rw-r--r-- | Userland/Services/LookupServer/DNSName.cpp | 3 | ||||
-rw-r--r-- | Userland/Services/LookupServer/LookupServer.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Services/LookupServer/DNSName.cpp b/Userland/Services/LookupServer/DNSName.cpp index cb753f6ddb..b4f13c6c52 100644 --- a/Userland/Services/LookupServer/DNSName.cpp +++ b/Userland/Services/LookupServer/DNSName.cpp @@ -6,6 +6,7 @@ */ #include "DNSName.h" +#include <AK/Random.h> #include <AK/Vector.h> #include <ctype.h> @@ -64,7 +65,7 @@ void DNSName::randomize_case() for (char c : m_name) { // Randomize the 0x20 bit in every ASCII character. if (isalpha(c)) { - if (arc4random_uniform(2)) + if (get_random_uniform(2)) c |= 0x20; else c &= ~0x20; diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp index 52eb6a4752..c709c2ad40 100644 --- a/Userland/Services/LookupServer/LookupServer.cpp +++ b/Userland/Services/LookupServer/LookupServer.cpp @@ -10,6 +10,7 @@ #include <AK/ByteBuffer.h> #include <AK/Debug.h> #include <AK/HashMap.h> +#include <AK/Random.h> #include <AK/String.h> #include <AK/StringBuilder.h> #include <LibCore/ConfigFile.h> @@ -194,7 +195,7 @@ Vector<DNSAnswer> LookupServer::lookup(const DNSName& name, const String& namese { DNSPacket request; request.set_is_query(); - request.set_id(arc4random_uniform(UINT16_MAX)); + request.set_id(get_random_uniform(UINT16_MAX)); DNSName name_in_question = name; if (should_randomize_case == ShouldRandomizeCase::Yes) name_in_question.randomize_case(); |