From: Martin Storsjo Date: Wed, 19 Dec 2012 23:20:00 +0000 (+0200) Subject: Don't match further SRTP profiles after one match has been found X-Git-Tag: gnutls_3_1_6~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3ea2626100050612dc72f8263341cffd59ec0df;p=thirdparty%2Fgnutls.git Don't match further SRTP profiles after one match has been found This makes SRTP profile matching more straightforward and intuitive, when the first matching SRTP profile will be the one selected, not the last one as before. Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/lib/ext/srtp.c b/lib/ext/srtp.c index 95d7a3fb89..8474aa8490 100644 --- a/lib/ext/srtp.c +++ b/lib/ext/srtp.c @@ -208,12 +208,14 @@ _gnutls_srtp_recv_params (gnutls_session_t session, return gnutls_assert_val(GNUTLS_E_UNEXPECTED_PACKET_LENGTH); } + priv->selected_profile = 0; + while (len > 0) { DECR_LEN (data_size, 2); profile = _gnutls_read_uint16 (p); - for (i = 0; i < priv->profiles_size;i++) + for (i = 0; i < priv->profiles_size && priv->selected_profile == 0; i++) { if (priv->profiles[i] == profile) {