aboutsummaryrefslogtreecommitdiff
path: root/src/serializable.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-08-11 14:20:18 +0100
committerGravatar Sadie Powell2022-08-11 15:40:57 +0100
commitf88fbaa2fe91c22f1c7280ecd96c2bcf92f73a4d (patch)
treee35803070a6ca8e50ee2d07b2e6c0d71230d53f3 /src/serializable.cpp
parentClean up the sockaddrs documentation comments. (diff)
Move aptosa/untosa into the sockaddrs union and add from/from_ip.
The struct will also now always be zero-initialized by default which removes the footgun which has happened previously where the union has been accessed before being initialized leading to it containing weird values.
Diffstat (limited to 'src/serializable.cpp')
-rw-r--r--src/serializable.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/serializable.cpp b/src/serializable.cpp
index cad72cf8c..57c71bd29 100644
--- a/src/serializable.cpp
+++ b/src/serializable.cpp
@@ -163,8 +163,8 @@ bool User::Deserialize(Serializable::Data& data)
else
oper = std::make_shared<OperInfo>(user_oper);
- irc::sockets::sockaddrs sa;
- if (irc::sockets::aptosa(client_addr, client_port, sa) || irc::sockets::untosa(client_addr, sa))
+ irc::sockets::sockaddrs sa(false);
+ if (sa.from_ip_port(client_addr, client_port) || sa.from_unix(client_addr))
client_sa = sa;
InvalidateCache();
@@ -246,8 +246,8 @@ bool LocalUser::Deserialize(Serializable::Data& data)
.Load("server_sa.port", server_port);
// Apply the rest of the members.
- irc::sockets::sockaddrs sa;
- if (irc::sockets::aptosa(server_addr, server_port, sa) || irc::sockets::untosa(server_addr, sa))
+ irc::sockets::sockaddrs sa(false);
+ if (sa.from_ip_port(server_addr, server_port) || sa.from_unix(server_addr))
server_sa = sa;
// These are bitfields so we need to ensure they only get the appropriate bits.