diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 57c8faf16..63eba3e1b 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -1387,8 +1387,8 @@ void ConfigManager::process_config(tl_object_ptr config) { shared_config.set_option_integer("call_packet_timeout_ms", config->call_packet_timeout_ms_); shared_config.set_option_integer("call_receive_timeout_ms", config->call_receive_timeout_ms_); - shared_config.set_option_integer("message_text_length_max", config->message_length_max_); - shared_config.set_option_integer("message_caption_length_max", config->caption_length_max_); + shared_config.set_option_integer("message_text_length_max", clamp(config->message_length_max_, 4096, 1000000)); + shared_config.set_option_integer("message_caption_length_max", clamp(config->caption_length_max_, 1024, 1000000)); if (config->gif_search_username_.empty()) { shared_config.set_option_empty("animation_search_bot_username"); diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index 4342e17b0..37a9f5f3c 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -3657,6 +3657,11 @@ vector get_message_entities(vector= MAX_SECRET_CHAT_ENTITIES) { + entities.resize(MAX_SECRET_CHAT_ENTITIES); + } return entities; }