From f88fbaa2fe91c22f1c7280ecd96c2bcf92f73a4d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 11 Aug 2022 14:20:18 +0100 Subject: 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. --- src/modules/m_cloaking.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/modules/m_cloaking.cpp') diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index b04295ef1..c8a8cfaa2 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -509,8 +509,8 @@ public: { std::string chost; - irc::sockets::sockaddrs hostip; - bool host_is_ip = irc::sockets::aptosa(host, ip.port(), hostip) && hostip == ip; + irc::sockets::sockaddrs hostip(false); + bool host_is_ip = hostip.from_ip_port(host, ip.port()) && hostip == ip; switch (info.mode) { @@ -569,7 +569,7 @@ CmdResult CommandCloak::Handle(User* user, const Params& parameters) // If we're cloaking an IP address we pass it in the IP field too. irc::sockets::sockaddrs sa; - const char* ipaddr = irc::sockets::aptosa(parameters[0], 0, sa) ? parameters[0].c_str() : ""; + const char* ipaddr = sa.from_ip(parameters[0]) ? parameters[0].c_str() : ""; unsigned int id = 0; for (const auto& info : mod->cloaks) -- cgit v1.3.1-10-gc9f91