diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-10-22 19:27:32 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-10-22 19:27:32 +0200 |
commit | 7571d61a328b3ea75a307a3ff24c38cc02c8d108 (patch) | |
tree | 8728f088e758f318acb74fd081ac6f8f7c1fa26d /src/dns.cpp | |
parent | 8a3b2f80919eab18567ad526dae84d80032de4f5 (diff) |
Fail AAAA DNS queries if inet_ntop() fails
Diffstat (limited to 'src/dns.cpp')
-rw-r--r-- | src/dns.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index 977f4bad0..75e5731fe 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -677,7 +677,13 @@ DNSResult DNS::GetResult() case DNS_QUERY_AAAA: { - inet_ntop(AF_INET6, data.first, formatted, sizeof(formatted)); + if (!inet_ntop(AF_INET6, data.first, formatted, sizeof(formatted))) + { + std::string ro = req->orig; + delete req; + return DNSResult(this_id | ERROR_MASK, "inet_ntop() failed", 0, ro); + } + resultstr = formatted; /* Special case. Sending ::1 around between servers |