diff --git a/td/mtproto/TlsInit.cpp b/td/mtproto/TlsInit.cpp index 115512eb4..d36b94f39 100644 --- a/td/mtproto/TlsInit.cpp +++ b/td/mtproto/TlsInit.cpp @@ -157,7 +157,7 @@ class TlsHelloContext { return grease_.size(); } Slice get_domain() const { - return domain_; + return Slice(domain_).substr(0, 255); } private: diff --git a/td/telegram/net/Proxy.cpp b/td/telegram/net/Proxy.cpp index db68882f3..b20c9478b 100644 --- a/td/telegram/net/Proxy.cpp +++ b/td/telegram/net/Proxy.cpp @@ -17,6 +17,9 @@ Result 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"); }