From 2f1b857b7e7cd299afc2f975ab2bdb2807375764 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 26 Nov 2020 13:44:48 +0300 Subject: [PATCH] Disallow empty group call identifier in requests. --- td/telegram/InputGroupCallId.cpp | 5 ++++- td/telegram/InputGroupCallId.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/td/telegram/InputGroupCallId.cpp b/td/telegram/InputGroupCallId.cpp index 74c2f04d4..1bc29c7d0 100644 --- a/td/telegram/InputGroupCallId.cpp +++ b/td/telegram/InputGroupCallId.cpp @@ -15,8 +15,11 @@ InputGroupCallId::InputGroupCallId(const tl_object_ptrid_), access_hash(input_group_call->access_hash_) { } -Result InputGroupCallId::from_group_call_id(const string &group_call_id) { +Result InputGroupCallId::from_group_call_id(const string &group_call_id, bool allow_empty) { if (group_call_id.empty()) { + if (!allow_empty) { + return Status::Error(400, "Empty group call identifier specified"); + } return InputGroupCallId(); } diff --git a/td/telegram/InputGroupCallId.h b/td/telegram/InputGroupCallId.h index b8583e1e6..e8f1d1313 100644 --- a/td/telegram/InputGroupCallId.h +++ b/td/telegram/InputGroupCallId.h @@ -28,7 +28,7 @@ class InputGroupCallId { InputGroupCallId(int64 group_call_id, int64 access_hash) : group_call_id(group_call_id), access_hash(access_hash) { } - static Result from_group_call_id(const string &group_call_id); + static Result from_group_call_id(const string &group_call_id, bool allow_empty = false); string get_group_call_id() const;