summaryrefslogtreecommitdiff
path: root/lib/extensions.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2015-11-29 09:24:12 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2015-11-29 10:20:55 +0100
commit68465b818f2bf39d4b8a1f5cae42c03fa1b9e338 (patch)
treef677519b8cff953014b2520b428921119df2731e /lib/extensions.c
parente54d59e8aa25c39484e979ad9e4eb861e670578b (diff)
downloadgnutls-68465b818f2bf39d4b8a1f5cae42c03fa1b9e338.tar.gz
When decoding extensions do not ignore decoding errors
That is, move from a parsing error tolerance to a more strict decoding approach. Relates #40
Diffstat (limited to 'lib/extensions.c')
-rw-r--r--lib/extensions.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/extensions.c b/lib/extensions.c
index 6a67f81bc2..c65aa9fca4 100644
--- a/lib/extensions.c
+++ b/lib/extensions.c
@@ -190,14 +190,14 @@ _gnutls_parse_extensions(gnutls_session_t session,
}
#endif
- DECR_LENGTH_RET(data_size, 2, 0);
+ DECR_LENGTH_RET(data_size, 2, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
next = _gnutls_read_uint16(data);
pos += 2;
- DECR_LENGTH_RET(data_size, next, 0);
+ DECR_LENGTH_RET(data_size, next, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
do {
- DECR_LENGTH_RET(next, 2, 0);
+ DECR_LENGTH_RET(next, 2, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
type = _gnutls_read_uint16(&data[pos]);
pos += 2;
@@ -211,11 +211,11 @@ _gnutls_parse_extensions(gnutls_session_t session,
_gnutls_extension_list_add(session, type);
}
- DECR_LENGTH_RET(next, 2, 0);
+ DECR_LENGTH_RET(next, 2, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
size = _gnutls_read_uint16(&data[pos]);
pos += 2;
- DECR_LENGTH_RET(next, size, 0);
+ DECR_LENGTH_RET(next, size, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
sdata = &data[pos];
pos += size;