summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-02-29 09:57:40 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-02-29 09:57:40 +0100
commitc9a6fd2bf2c8e0b5efbc851460f7917be511d114 (patch)
tree9e41923336e2dda37ac12e72940db608ae8a8acd
parent63ac0b64a55ee9cb0df77c4174f42cd2c9ee4429 (diff)
downloadgnutls-c9a6fd2bf2c8e0b5efbc851460f7917be511d114.tar.gz
ecc: optimized extension parsing
-rw-r--r--lib/ext/ecc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/ext/ecc.c b/lib/ext/ecc.c
index d8cfbeb108..ec9fc25bfb 100644
--- a/lib/ext/ecc.c
+++ b/lib/ext/ecc.c
@@ -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