@@ -46,10 +46,11 @@ #import "OFInvalidArgumentException.h" #import "OFListenFailedException.h" #import "OFNotImplementedException.h" #import "OFNotOpenException.h" #import "OFOutOfMemoryException.h" +#import "OFOutOfRangeException.h" #import "OFSetOptionFailedException.h" #import "socket.h" #import "socket_helpers.h" #import "resolver.h" @@ -599,21 +600,26 @@ } #endif - (OFString *)remoteAddress { - OFString *ret; + of_socket_address_t address; if (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; if (_address == NULL) @throw [OFInvalidArgumentException exception]; - of_address_to_string_and_port(_address, _addressLength, &ret, NULL); + if (_addressLength > sizeof(address.address)) + @throw [OFOutOfRangeException exception]; + + memset(&address, '\0', sizeof(address)); + memcpy(&address.address, _address, _addressLength); + address.length = _addressLength; - return ret; + return of_socket_address_ip_string(&address, NULL); } - (bool)isListening { return _listening;