summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorrrivers2 <5981058-rrivers2@users.noreply.gitlab.com>2020-05-24 23:11:01 +0000
committerrrivers2 <5981058-rrivers2@users.noreply.gitlab.com>2020-05-24 23:11:01 +0000
commit1d4615aa650dad1c01452d46396c0307304b0245 (patch)
tree86ebe6218f77cd5cd59aaeed82c418d69e88eb3d /lib
parent330a44728e14ddd3358ace6481ebd9bc687355ca (diff)
downloadgnutls-1d4615aa650dad1c01452d46396c0307304b0245.tar.gz
Update session_ticket.c to add support for zero length session tickets returned from the server
check that ticket_len > 0 prior to calling gnutls_realloc_fast Signed-off-by: Rod Rivers <5981058-rrivers2@users.noreply.gitlab.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/ext/session_ticket.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/ext/session_ticket.c b/lib/ext/session_ticket.c
index c854d9c2a9..8d4595821a 100644
--- a/lib/ext/session_ticket.c
+++ b/lib/ext/session_ticket.c
@@ -787,15 +787,17 @@ int _gnutls_recv_new_session_ticket(gnutls_session_t session)
ret = GNUTLS_E_MEMORY_ERROR;
goto error;
}
- priv->session_ticket =
- gnutls_realloc_fast(priv->session_ticket, ticket_len);
- if (!priv->session_ticket) {
- gnutls_free(priv);
- gnutls_assert();
- ret = GNUTLS_E_MEMORY_ERROR;
- goto error;
+ if (ticket_len > 0) {
+ priv->session_ticket =
+ gnutls_realloc_fast(priv->session_ticket, ticket_len);
+ if (!priv->session_ticket) {
+ gnutls_free(priv);
+ gnutls_assert();
+ ret = GNUTLS_E_MEMORY_ERROR;
+ goto error;
+ }
+ memcpy(priv->session_ticket, p, ticket_len);
}
- memcpy(priv->session_ticket, p, ticket_len);
priv->session_ticket_len = ticket_len;
epriv = priv;