1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Fix potential NULL pointer dereference

* src/gnutls.c (ssl_connect_wget): check for NULL before calls
This commit is contained in:
Ander Juaristi 2015-11-20 18:35:31 +01:00 committed by Giuseppe Scrivano
parent b1c7777037
commit 46cd721c0f

View File

@ -632,10 +632,14 @@ ssl_connect_wget (int fd, const char *hostname, int *continue_session)
if (!gnutls_session_is_resumed (session)) if (!gnutls_session_is_resumed (session))
{ {
if (!ctx || !ctx->session_data || gnutls_session_set_data (session, ctx->session_data->data, ctx->session_data->size)) if (!ctx || !ctx->session_data || gnutls_session_set_data (session, ctx->session_data->data, ctx->session_data->size))
{
if (ctx && ctx->session_data)
{ {
/* server does not want to continue the session */ /* server does not want to continue the session */
if (ctx->session_data->data)
gnutls_free (ctx->session_data->data); gnutls_free (ctx->session_data->data);
gnutls_free (ctx->session_data); gnutls_free (ctx->session_data);
}
gnutls_deinit (session); gnutls_deinit (session);
return false; return false;
} }