1
0
mirror of https://github.com/coturn/coturn.git synced 2025-10-25 13:00:59 +02:00

Fix a segfault when a TLS context is not used

If the configuration contains entries such as:

  no-tlsv1
  no-tlsv1_1

then the SSL context is NULL. The previous code was simple enough that it
handled this case; the new code needs to deal with it explicitly.

[*] https://github.com/coturn/coturn/issues/770
This commit is contained in:
Mark Hills 2021-06-06 11:03:20 +01:00 committed by Mészáros Mihály
parent e5f62d5c67
commit 713bbefd5e

View File

@ -304,12 +304,17 @@ typedef struct update_ssl_ctx_cb_args {
struct event *next;
} update_ssl_ctx_cb_args_t;
/*
* Copy SSL context at "from", which may be NULL if no context in use
*/
static void replace_one_ssl_ctx(SSL_CTX **to, SSL_CTX *from)
{
if (*to)
SSL_CTX_free(*to);
if (from)
if (from != NULL)
SSL_CTX_up_ref(from);
*to = from;
}