]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Don't match further SRTP profiles after one match has been found
authorMartin Storsjo <martin@martin.st>
Wed, 19 Dec 2012 23:20:00 +0000 (01:20 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 20 Dec 2012 23:21:08 +0000 (01:21 +0200)
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 <nmav@gnutls.org>
lib/ext/srtp.c

index 95d7a3fb8969245579caa473983c73dfe6226f86..8474aa849052ff2857e506706cc22810acfef56f 100644 (file)
@@ -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)
             {