summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-08-21 14:06:51 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2015-08-21 14:43:43 +0200
commitafe8798d74a789104d53ef3f2012aaddb75cded5 (patch)
treef92b27854f9b83a43a81aa31c15912b738ed65bc
parent691531085765451f27f1438bf4beec9a4fa1e1cd (diff)
downloadgnutls-afe8798d74a789104d53ef3f2012aaddb75cded5.tar.gz
session packing: corrected issue in PSK session unpack
-rw-r--r--lib/gnutls_session_pack.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gnutls_session_pack.c b/lib/gnutls_session_pack.c
index 7f4111d1a6..71d7a872e6 100644
--- a/lib/gnutls_session_pack.c
+++ b/lib/gnutls_session_pack.c
@@ -618,7 +618,6 @@ pack_psk_auth_info(gnutls_session_t session, gnutls_buffer_st * ps)
/* write the real size */
_gnutls_write_uint32(ps->length - cur_size,
ps->data + size_offset);
-
return 0;
}
@@ -628,6 +627,7 @@ unpack_psk_auth_info(gnutls_session_t session, gnutls_buffer_st * ps)
size_t username_size, hint_size;
int ret;
psk_auth_info_t info;
+ unsigned pack_size;
ret =
_gnutls_auth_info_set(session, GNUTLS_CRD_PSK,
@@ -641,6 +641,10 @@ unpack_psk_auth_info(gnutls_session_t session, gnutls_buffer_st * ps)
if (info == NULL)
return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR);
+ BUFFER_POP_NUM(ps, pack_size);
+ if (pack_size == 0)
+ return GNUTLS_E_INVALID_REQUEST;
+
BUFFER_POP_NUM(ps, username_size);
if (username_size > sizeof(info->username)) {
gnutls_assert();