Skip to content

Commit

Permalink
Reject replies to DNS PTR requests that contain invalid characters
Browse files Browse the repository at this point in the history
Fixes issue #1033 reported by @ping86
  • Loading branch information
attilamolnar committed Apr 16, 2015
1 parent 4dd7fb6 commit 6058483
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dns.cpp
Expand Up @@ -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:
Expand Down

0 comments on commit 6058483

Please sign in to comment.