From 60fd3a45428392e75a4f79cd00df91e510409df4 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 12 Nov 2019 07:17:57 -0500 Subject: [PATCH] fixed #1434 use memset inster bzero --- libi2pd/Transports.cpp | 2 +- libi2pd/util.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libi2pd/Transports.cpp b/libi2pd/Transports.cpp index 7e4ab797..b081439b 100644 --- a/libi2pd/Transports.cpp +++ b/libi2pd/Transports.cpp @@ -652,7 +652,7 @@ namespace transport { if (it->second.delayedMessages.size () > 0) { - it->second.numAttempts = 0; + // it->second.numAttempts = 0; // TODO: recognize if connect failed ConnectToPeer (ident, it->second); } else diff --git a/libi2pd/util.cpp b/libi2pd/util.cpp index 96e8ad4c..76fe6d43 100644 --- a/libi2pd/util.cpp +++ b/libi2pd/util.cpp @@ -312,15 +312,14 @@ namespace net if (cur_ifname == ifname && cur->ifa_addr && cur->ifa_addr->sa_family == af) { // match - char * addr = new char[INET6_ADDRSTRLEN]; - bzero(addr, INET6_ADDRSTRLEN); + char addr[INET6_ADDRSTRLEN]; + memset (addr, 0, INET6_ADDRSTRLEN); if(af == AF_INET) inet_ntop(af, &((sockaddr_in *)cur->ifa_addr)->sin_addr, addr, INET6_ADDRSTRLEN); else inet_ntop(af, &((sockaddr_in6 *)cur->ifa_addr)->sin6_addr, addr, INET6_ADDRSTRLEN); freeifaddrs(addrs); std::string cur_ifaddr(addr); - delete[] addr; return boost::asio::ip::address::from_string(cur_ifaddr); } cur = cur->ifa_next;