1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:37:34 +00:00

LibDNS: Make DNS packet parsing fallible

Previously, a DNS packet containing an invalid name would be returned
with an empty name. With this change, an error is returned if any error
is encountered during parsing.
This commit is contained in:
Tim Ledbetter 2023-11-13 22:36:34 +00:00 committed by Andreas Kling
parent 95d62822bf
commit 1793f51bc6
8 changed files with 29 additions and 40 deletions

View file

@ -17,7 +17,7 @@ public:
Name() = default;
Name(DeprecatedString const&);
static Name parse(ReadonlyBytes data, size_t& offset, size_t recursion_level = 0);
static ErrorOr<Name> parse(ReadonlyBytes data, size_t& offset, size_t recursion_level = 0);
size_t serialized_size() const;
DeprecatedString const& as_string() const { return m_name; }