1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-27 13:14:15 +00:00

fixed #1434 use memset inster bzero

This commit is contained in:
orignal 2019-11-12 07:17:57 -05:00
parent c66f9c8d6d
commit 60fd3a4542
2 changed files with 3 additions and 4 deletions

View File

@ -652,7 +652,7 @@ namespace transport
{ {
if (it->second.delayedMessages.size () > 0) if (it->second.delayedMessages.size () > 0)
{ {
it->second.numAttempts = 0; // it->second.numAttempts = 0; // TODO: recognize if connect failed
ConnectToPeer (ident, it->second); ConnectToPeer (ident, it->second);
} }
else else

View File

@ -312,15 +312,14 @@ namespace net
if (cur_ifname == ifname && cur->ifa_addr && cur->ifa_addr->sa_family == af) if (cur_ifname == ifname && cur->ifa_addr && cur->ifa_addr->sa_family == af)
{ {
// match // match
char * addr = new char[INET6_ADDRSTRLEN]; char addr[INET6_ADDRSTRLEN];
bzero(addr, INET6_ADDRSTRLEN); memset (addr, 0, INET6_ADDRSTRLEN);
if(af == AF_INET) if(af == AF_INET)
inet_ntop(af, &((sockaddr_in *)cur->ifa_addr)->sin_addr, addr, INET6_ADDRSTRLEN); inet_ntop(af, &((sockaddr_in *)cur->ifa_addr)->sin_addr, addr, INET6_ADDRSTRLEN);
else else
inet_ntop(af, &((sockaddr_in6 *)cur->ifa_addr)->sin6_addr, addr, INET6_ADDRSTRLEN); inet_ntop(af, &((sockaddr_in6 *)cur->ifa_addr)->sin6_addr, addr, INET6_ADDRSTRLEN);
freeifaddrs(addrs); freeifaddrs(addrs);
std::string cur_ifaddr(addr); std::string cur_ifaddr(addr);
delete[] addr;
return boost::asio::ip::address::from_string(cur_ifaddr); return boost::asio::ip::address::from_string(cur_ifaddr);
} }
cur = cur->ifa_next; cur = cur->ifa_next;