From 7197c236323839deaddd281e0bc779e4195f90e9 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Mon, 8 Nov 2021 23:10:24 +0100 Subject: [PATCH] TNetwork: Possible ip address fix --- src/TNetwork.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index 859579f..5d511ea 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -205,9 +205,9 @@ void TNetwork::HandleDownload(SOCKET TCPSock) { void TNetwork::Authentication(const TConnection& ClientConnection) { auto Client = CreateClient(ClientConnection.Socket); - char AddrBuf[30]; - inet_ntoa(reinterpret_cast(&ClientConnection.SockAddr)->sin_addr); - auto str = inet_ntop(AF_INET, static_cast(reinterpret_cast(&ClientConnection.SockAddr)), AddrBuf, sizeof(struct sockaddr_in)); + char AddrBuf[64]; + // TODO: IPv6 would need this to be changed + auto str = inet_ntop(AF_INET, static_cast(reinterpret_cast(&ClientConnection.SockAddr)), AddrBuf, sizeof(ClientConnection.SockAddr)); Client->SetIdentifier("ip", str); std::string Rc;