From 6cb734357a3946017db5efd80fd2ac23c80023d5 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Fri, 29 Apr 2022 10:48:24 +0200 Subject: [PATCH] Fix socket remote address for accepted sockets --- lib/socket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/socket.cpp b/lib/socket.cpp index a9426e82..22f5e32b 100644 --- a/lib/socket.cpp +++ b/lib/socket.cpp @@ -519,7 +519,8 @@ void Socket::Connection::setBoundAddr(){ // Otherwise, read from socket pointer. Works for both SSL and non-SSL sockets, and real sockets passed as fd's, but not for non-sockets (duh) uint32_t boundport = 0; getSocketName(getSocket(), boundaddr, boundport); - getPeerName(getSocket(), remotehost, boundport); + socklen_t aLen = sizeof(remoteaddr); + getPeerName(getSocket(), remotehost, boundport, (sockaddr *)&remoteaddr, &aLen); } // Cleans up the socket by dropping the connection.