From 68f5fc98e46f63a8192e89d991874da7e53c04a4 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) (cherry picked from commit e2bce382c6a95490985b40d14f247d1ad54c9c8e) --- 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 c73771f33..0044f70c2 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2002,10 +2002,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