Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use INET6_ADDRSTRLEN instead of magic number 40.

Also 40 is too small, the string can be longer.
  • Loading branch information...
commit 6bf774d8536b63a95d59ef73ed142bdfd5ab9528 1 parent c48a686
@DarthGandalf DarthGandalf authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/Socket.cpp
View
4 src/Socket.cpp
@@ -262,11 +262,11 @@ void CSockManager::SetTDNSThreadFinished(TDNSTask* task, bool bBind, addrinfo* a
CString sBindhost;
CString sTargetHost;
if (!task->sBindhost.empty()) {
- char s[40] = {}; // 40 is enough for both ipv4 and ipv6 addresses, including 0 terminator.
+ char s[INET6_ADDRSTRLEN] = {};
getnameinfo(aiBind->ai_addr, aiBind->ai_addrlen, s, sizeof(s), NULL, 0, NI_NUMERICHOST);
sBindhost = s;
}
- char s[40] = {};
+ char s[INET6_ADDRSTRLEN] = {};
getnameinfo(aiTarget->ai_addr, aiTarget->ai_addrlen, s, sizeof(s), NULL, 0, NI_NUMERICHOST);
sTargetHost = s;
Please sign in to comment.
Something went wrong with that request. Please try again.