LibCore: Make ProxyData::port a u16

TCP ports are always u16 and this prevents invalid values from getting
into this field somehow.
This commit is contained in:
Andreas Kling 2026-01-22 10:52:18 +01:00 committed by Alexander Kalenik
parent b4cbd321d9
commit 2a6045833c
2 changed files with 2 additions and 2 deletions

View file

@ -21,7 +21,7 @@ struct ProxyData {
} type { Type::Direct };
IPv4Address host_ipv4;
int port { 0 };
u16 port { 0 };
bool operator==(ProxyData const& other) const = default;

View file

@ -178,7 +178,7 @@ ErrorOr<Core::ProxyData> decode(Decoder& decoder)
{
auto type = TRY(decoder.decode<Core::ProxyData::Type>());
auto host_ipv4 = IPv4Address(TRY(decoder.decode<u32>()));
auto port = TRY(decoder.decode<int>());
auto port = TRY(decoder.decode<u16>());
return Core::ProxyData { type, host_ipv4, port };
}