summaryrefslogtreecommitdiff
path: root/lib/gnutls_extensions.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-09-29 10:45:12 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-09-29 10:45:12 +0200
commit0a42348eaae840bcee74a87cbef04f3ae21ee480 (patch)
treec79e21cef86a8dfdc99b28886c980918ce27a456 /lib/gnutls_extensions.c
parenteeecd30139aea39ffc609aa4e5264ed4df3d60a6 (diff)
downloadgnutls-0a42348eaae840bcee74a87cbef04f3ae21ee480.tar.gz
Corrected bugs when restoring extensions during session resumtion.
Diffstat (limited to 'lib/gnutls_extensions.c')
-rw-r--r--lib/gnutls_extensions.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/gnutls_extensions.c b/lib/gnutls_extensions.c
index 9497d143ef..cfa5a03725 100644
--- a/lib/gnutls_extensions.c
+++ b/lib/gnutls_extensions.c
@@ -434,11 +434,10 @@ int i, ret;
extension_priv_data_t data;
int cur_size;
int size_offset;
-void* total_exts_pos;
+int total_exts_pos;
int exts = 0;
- total_exts_pos = packed->data + packed->length;
-
+ total_exts_pos = packed->length;
BUFFER_APPEND_NUM(packed, 0);
for (i = 0; i < extfunc_size; i++)
@@ -466,7 +465,7 @@ int exts = 0;
}
}
- _gnutls_write_uint32(exts, total_exts_pos);
+ _gnutls_write_uint32(exts, packed->data+total_exts_pos);
return 0;
@@ -509,7 +508,7 @@ int i;
for (i=0;i<MAX_EXT_TYPES;i++)
{
- if (session->internals.resumed_extension_int_data[i].type == type)
+ if (session->internals.resumed_extension_int_data[i].type == type || session->internals.resumed_extension_int_data[i].set == 0)
{
if (session->internals.resumed_extension_int_data[i].set != 0)
@@ -532,6 +531,7 @@ int max_exts = 0;
uint16_t type;
int size_for_type, cur_pos;
+
BUFFER_POP_NUM(packed, max_exts);
for (i = 0; i < max_exts; i++)
{
@@ -546,14 +546,14 @@ int size_for_type, cur_pos;
gnutls_assert();
return GNUTLS_E_PARSING_ERROR;
}
-
+
ret = unpack(packed, &data);
if (ret < 0)
{
gnutls_assert();
return ret;
}
-
+
/* verify that unpack read the correct bytes */
cur_pos = cur_pos - packed->length;
if (cur_pos /* read length */ != size_for_type)
@@ -561,6 +561,7 @@ int size_for_type, cur_pos;
gnutls_assert();
return GNUTLS_E_PARSING_ERROR;
}
+
_gnutls_ext_set_resumed_session_data(session, type, data);
}