From 8bd62e18304d5646709d4a3375dc719520556bef Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 27 Jun 2025 08:29:40 -0400 Subject: [PATCH] MT#55283 fix sdes_accept logic booboo Using `l->next` as a test for whether only one element is left in the list is not reliable. Use the actual list length instead. Update one affected test. Closes #1961 Change-Id: I5773715700220cd762e61090bac941ddd33afd9b (cherry picked from commit 02897ccb46ec45c3b7022ecc99f9fc095fe3cfa0) --- daemon/call.c | 4 +--- t/auto-daemon-tests-sdes-manipulations.pl | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index d8dfe15b7..b2d9a3bae 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1957,10 +1957,8 @@ static void __sdes_accept(struct call_media *media, const sdp_ng_flags *flags) { /* stop the iteration intentionally, if only one suite is left * this helps with a case, when the offerer left with no suites, * which can be allowed, but we need to still have at least something */ - if (l->next == NULL) { - l = l->prev; + if (media->sdes_in.length == 1) break; - } ilogs(crypto, LOG_DEBUG, "Dropping offered crypto suite '%s' from offer due to %s", offered_cps->params.crypto_suite->name, diff --git a/t/auto-daemon-tests-sdes-manipulations.pl b/t/auto-daemon-tests-sdes-manipulations.pl index 82cc1992d..13736983e 100644 --- a/t/auto-daemon-tests-sdes-manipulations.pl +++ b/t/auto-daemon-tests-sdes-manipulations.pl @@ -1418,7 +1418,7 @@ c=IN IP4 203.0.113.1 a=rtpmap:0 PCMU/8000 a=sendrecv a=rtcp:PORT -a=crypto:4 AES_256_CM_HMAC_SHA1_32 inline:CRYPTO256 +a=crypto:3 AES_256_CM_HMAC_SHA1_80 inline:CRYPTO256 SDP