summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-10-22 19:27:32 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-10-22 19:27:32 +0200
commit7571d61a328b3ea75a307a3ff24c38cc02c8d108 (patch)
tree8728f088e758f318acb74fd081ac6f8f7c1fa26d /src
parent8a3b2f80919eab18567ad526dae84d80032de4f5 (diff)
Fail AAAA DNS queries if inet_ntop() fails
Diffstat (limited to 'src')
-rw-r--r--src/dns.cpp8
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