From 95ff757c73787f6e9ecca6acd2957f27ac92b6ad Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 6 Sep 2023 18:48:41 +0300 Subject: [PATCH] Immediately return an error if more than 50 inline query results are provided. --- telegram-bot-api/Client.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index cea1026..33d4f31 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -6232,6 +6232,10 @@ td::Result>> Clien if (values.type() != td::JsonValue::Type::Array) { return td::Status::Error(400, "Expected an Array of inline query results"); } + constexpr std::size_t MAX_INLINE_QUERY_RESULT_COUNT = 50; + if (values.get_array().size() > MAX_INLINE_QUERY_RESULT_COUNT) { + return td::Status::Error(400, "Too many inline query results specified"); + } td::vector> inline_query_results; for (auto &value : values.get_array()) {