Chromium Code Reviews| Index: net/dns/dns_util.cc |
| diff --git a/net/dns/dns_util.cc b/net/dns/dns_util.cc |
| index 48be035c0e3380d37f5aa0d29e3406760b97db6d..716fb685daefd054129e30974a425f44919b2a3b 100644 |
| --- a/net/dns/dns_util.cc |
| +++ b/net/dns/dns_util.cc |
| @@ -33,6 +33,10 @@ namespace net { |
| // Based on DJB's public domain code. |
| bool DNSDomainFromDot(const base::StringPiece& dotted, std::string* out) { |
| + // Refuse to convert invalid host names. |
|
Julia Tuttle
2016/09/09 20:24:38
This is commented out; remove it?
mmenke
2016/09/09 20:38:44
Oops, thanks! I hadn't realized this was actually
|
| + // if (!IsHostnameValid(dotted)) |
| + // return false; |
| + |
| const char* buf = dotted.data(); |
| unsigned n = dotted.size(); |
| char label[63]; |
| @@ -83,6 +87,11 @@ bool DNSDomainFromDot(const base::StringPiece& dotted, std::string* out) { |
| return true; |
| } |
| +bool IsValidDNSDomain(const base::StringPiece& dotted) { |
| + std::string dns_formatted; |
| + return DNSDomainFromDot(dotted, &dns_formatted); |
| +} |
| + |
| std::string DNSDomainToString(const base::StringPiece& domain) { |
| std::string ret; |