From 1bf628887e3910199d1e18fb98bbe92f610c838c Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 16 Sep 2021 12:28:13 -0400 Subject: [PATCH] TT#14008 avoid duplicate bencode dict keys Multiple untagged monologues can exist at the same time which would lead to a broken bencode dictionary. Instead use a pseudo label to distinguish them. Change-Id: I0f41c42df8ec17c1c4fb5cc6451ea039612e505f (cherry picked from commit 6f0439daf3fe2269cd48403ab3fda8212883007a) --- daemon/call_interfaces.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 93d47b6fa..9df598f8d 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1745,7 +1745,13 @@ static void ng_stats_monologue(bencode_item_t *dict, const struct call_monologue if (!dict) goto stats; - sub = bencode_dictionary_add_dictionary(dict, ml->tag.s ? : ""); + if (ml->tag.len) + sub = bencode_dictionary_add_dictionary(dict, ml->tag.s); + else { + char *buf = bencode_buffer_alloc(dict->buffer, 32); + snprintf(buf, 32, "", ml->unique_id); + sub = bencode_dictionary_add_dictionary(dict, buf); + } bencode_dictionary_add_str(sub, "tag", &ml->tag); if (ml->viabranch.s)