diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-04-16 18:04:03 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-04-16 18:04:03 +0200 |
commit | 6058483d9fbc1b904d5ae7cfea47bfcde5c5b559 (patch) | |
tree | e0a77e56044b08b19872b36a7513a3d298eb9c64 | |
parent | 4dd7fb60a8e46856cb2df3fcda56b9b119072552 (diff) |
Reject replies to DNS PTR requests that contain invalid characters
Fixes issue #1033 reported by @ping86
-rw-r--r-- | src/dns.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index 75e5731fe..14305ccab 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -700,8 +700,16 @@ DNSResult DNS::GetResult() /* Identical handling to PTR */ case DNS_QUERY_PTR: + { /* Reverse lookups just come back as char* */ resultstr = std::string((const char*)data.first); + if (resultstr.find_first_not_of("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-") != std::string::npos) + { + std::string ro = req->orig; + delete req; + return DNSResult(this_id | ERROR_MASK, "Invalid char(s) in reply", 0, ro); + } + } break; default: |