mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 15:55:07 -05:00
tls: don't accept NULL ALPN name in TLS_CreateInstance()
The TLS_CreateInstance() function handles a NULL alpn_name, but the
other session functions would crash if it was NULL. Change the function
to not handle the NULL for consistency and avoid potential confusion.
Fixes: 3e32e7e694 ("tls: move gnutls code into tls_gnutls.c")
This commit is contained in:
@@ -174,7 +174,7 @@ TLS_CreateInstance(int server_mode, int sock_fd, const char *server_name, const
|
||||
inst->session = NULL;
|
||||
inst->server = server_mode;
|
||||
inst->label = Strdup(label);
|
||||
inst->alpn_name = alpn_name ? Strdup(alpn_name) : NULL;
|
||||
inst->alpn_name = Strdup(alpn_name);
|
||||
|
||||
r = gnutls_init(&inst->session, GNUTLS_NONBLOCK | GNUTLS_NO_TICKETS |
|
||||
(server_mode ? GNUTLS_SERVER : GNUTLS_CLIENT));
|
||||
@@ -238,8 +238,6 @@ TLS_DestroyInstance(TLS_Instance inst)
|
||||
gnutls_deinit(inst->session);
|
||||
|
||||
Free(inst->label);
|
||||
|
||||
if (inst->alpn_name)
|
||||
Free(inst->alpn_name);
|
||||
|
||||
Free(inst);
|
||||
|
||||
Reference in New Issue
Block a user