From fd763f2804558ace4f13ff9f92a3f71d39c51145 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 3 Jul 2025 15:32:34 +0200 Subject: [PATCH] MT#63082 crypto: ignore dummy suites If dummy definition with no tag, algo etc. just ignore it, otherwise not excluded and is dangling in outgoing SDP. Also add according test. Change-Id: Ib7c981ee66b1ce8cb363a9cc181231c68baa69cd --- daemon/sdp.c | 11 ++++++++--- t/auto-daemon-tests.pl | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index 806292886..69e9dd377 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -477,6 +477,11 @@ static bool parse_address(struct network_address *address) { } #define EXTRACT_TOKEN(field) do { if (!str_token_sep(&output->field, value_str, ' ')) return -1; } while (0) +#define EXTRACT_TOKEN_EXCL_INCORRECT(field) \ + do { \ + if (!str_token_sep(&output->field, value_str, ' ')) \ + goto error; \ + } while (0) #define EXTRACT_NETWORK_ADDRESS_NP(field) \ do { EXTRACT_TOKEN(field.network_type); \ EXTRACT_TOKEN(field.address_type); \ @@ -607,9 +612,9 @@ static int parse_attribute_crypto(struct sdp_attribute *output) { output->attr = ATTR_CRYPTO; PARSE_INIT; - EXTRACT_TOKEN(crypto.tag_str); - EXTRACT_TOKEN(crypto.crypto_suite_str); - EXTRACT_TOKEN(crypto.key_params_str); + EXTRACT_TOKEN_EXCL_INCORRECT(crypto.tag_str); + EXTRACT_TOKEN_EXCL_INCORRECT(crypto.crypto_suite_str); + EXTRACT_TOKEN_EXCL_INCORRECT(crypto.key_params_str); c = &output->crypto; diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 955a156d2..293f5ae06 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -26040,6 +26040,41 @@ SDP like($resp, qr/^Error reason: "Failed to parse SDP"/, 'invalid SDP parsing error'); +new_call; + +offer('Throw away dummy crypto', { DTLS => 'off' }, <