]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
ecc: optimized extension parsing
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 29 Feb 2016 08:57:40 +0000 (09:57 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 29 Feb 2016 08:57:40 +0000 (09:57 +0100)
lib/ext/ecc.c

index d8cfbeb1085e65c01581f617f4d8dccc404b38db..ec9fc25bfb27d29c78a349f0e77cc880dcc49fb2 100644 (file)
@@ -220,11 +220,18 @@ _gnutls_supported_ecc_pf_recv_params(gnutls_session_t session,
                            (GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION);
 
                len = data[0];
+               if (len < 1)
+                       return
+                           gnutls_assert_val
+                           (GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION);
+
                DECR_LEN(data_size, len + 1);
 
                for (i = 1; i <= len; i++)
-                       if (data[i] == 0)       /* uncompressed */
+                       if (data[i] == 0) {     /* uncompressed */
                                uncompressed = 1;
+                               break;
+                       }
 
                if (uncompressed == 0)
                        return