From: Nikos Mavrogiannopoulos Date: Sun, 26 Feb 2012 09:50:53 +0000 (+0100) Subject: Corrected session resumption for DTLS X-Git-Tag: gnutls_3_0_15~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1d8f27d72a6efc96bf4f1901456bc4227a057ac;p=thirdparty%2Fgnutls.git Corrected session resumption for DTLS --- diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index 648ed1cdbf..e6f3f27200 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -436,10 +436,20 @@ _gnutls_read_client_hello (gnutls_session_t session, uint8_t * data, return GNUTLS_E_UNEXPECTED_PACKET_LENGTH; } DECR_LEN (len, session_id_len); - session_id = &data[pos]; - ret = _gnutls_server_restore_session (session, session_id, session_id_len); pos += session_id_len; + + if (IS_DTLS(session)) + { + int cookie_size; + + DECR_LEN (len, 1); + cookie_size = data[pos++]; + DECR_LEN (len, cookie_size); + pos+=cookie_size; + } + + ret = _gnutls_server_restore_session (session, session_id, session_id_len); if (session_id_len > 0) session->internals.resumption_requested = 1; @@ -486,16 +496,6 @@ _gnutls_read_client_hello (gnutls_session_t session, uint8_t * data, session->internals.resumed = RESUME_FALSE; } - if (IS_DTLS(session)) - { - int cookie_size; - - DECR_LEN (len, 1); - cookie_size = data[pos++]; - DECR_LEN (len, cookie_size); - pos+=cookie_size; - } - /* Remember ciphersuites for later */ DECR_LEN (len, 2);