Restrict proxy server name length.

GitOrigin-RevId: d2e18866ff7fd977655cf27c3295b716237d92c7
This commit is contained in:
levlam 2020-01-24 15:57:28 +03:00
parent 2f9db6e6e6
commit 59f938405e
2 changed files with 4 additions and 1 deletions

View File

@ -157,7 +157,7 @@ class TlsHelloContext {
return grease_.size();
}
Slice get_domain() const {
return domain_;
return Slice(domain_).substr(0, 255);
}
private:

View File

@ -17,6 +17,9 @@ Result<Proxy> Proxy::from_td_api(string server, int port, td_api::ProxyType *pro
if (server.empty()) {
return Status::Error(400, "Server name can't be empty");
}
if (server.size() > 255) {
return Status::Error(400, "Server name is too long");
}
if (port <= 0 || port > 65535) {
return Status::Error(400, "Wrong port number");
}