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_ident.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/modules/m_ident.cpp') diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 6866af3d4..17b5c4c24 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -120,11 +120,8 @@ public: done = false; - irc::sockets::sockaddrs bindaddr; - irc::sockets::sockaddrs connaddr; - - memcpy(&bindaddr, &user->server_sa, sizeof(bindaddr)); - memcpy(&connaddr, &user->client_sa, sizeof(connaddr)); + irc::sockets::sockaddrs bindaddr(user->server_sa); + irc::sockets::sockaddrs connaddr(user->client_sa); if (connaddr.family() == AF_INET6) { -- cgit v1.3.1-10-gc9f91