Skip to content

Commit

Permalink
Fix a segfault when a TLS context is not used
Browse files Browse the repository at this point in the history
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.

[*] coturn#770
  • Loading branch information
hills authored and misi committed Jun 15, 2021
1 parent e5f62d5 commit 713bbef
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/apps/relay/netengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 713bbef

Please sign in to comment.