[Home]

Summary:ASTERISK-27339: [patch] Crash on ast_ssl_teardown when stopping.
Reporter:Alexander Traud (traud)Labels:patch pjsip
Date Opened:2017-10-13 08:09:15Date Closed:2017-10-15 13:54:26
Priority:MinorRegression?
Status:Closed/CompleteComponents:Channels/chan_sip/TCP-TLS
Versions:13.17.2 14.6.2 15.0.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) tls_cfg_can_be_NULL.patch
Description:[Review Request #1875|http://reviewboard.asterisk.org/r/1875/] introduced a possible crash in the module chan_sip. When {{tcptls:ast_tcptls_server_start}} was unable to create a TLS server (for example because chan_pjsip is using the same port), {{chan:sip:reload_config}} set the whole {{tls_cfg}} to {{NULL}}. However, {{tcptls:ast_ssl_teardown}} expects that this memory address is never {{NULL}}.

*Steps to Reproduce:*
1. set sip.conf and pjsip.conf to {{bindaddr=::}}
2. start Asterisk to reload those configuration files

The command-line interface (CLI) of Asterisk displays:
{code}
ERROR: tcptls.c: ast_tcptls_server_start: Unable to bind SIP TLS server to [::]:5061: Address already in use
ERROR: chan_sip.c: reload_config: TLS Server start failed. Not listening on TLS socket.
{code}

3. $ core stop when convenient

*Expected Result:*
Asterisk should quit.

*Actual Result:*
{code}
Thread 1 "asterisk" received signal SIGSEGV, Segmentation fault.
in ast_ssl_teardown (cfg=0x0) at tcptls.c:1345
1345 if (cfg->ssl_ctx) {
in unload_module () at chan_sip.c:35570
in modules_shutdown () at loader.c:617
in really_quit (num=0, niceness=SHUTDOWN_REALLY_NICE, restart=0) at asterisk.c:2222
{code}
Comments:By: Friendly Automation (friendly-automation) 2017-10-15 13:54:27.108-0500

Change 6789 merged by Jenkins2:
tcptls: NULL-check the parameter of ast_ssl_teardown before accessing it.

[https://gerrit.asterisk.org/6789|https://gerrit.asterisk.org/6789]

By: Friendly Automation (friendly-automation) 2017-10-15 14:11:16.121-0500

Change 6791 merged by Joshua Colp:
tcptls: NULL-check the parameter of ast_ssl_teardown before accessing it.

[https://gerrit.asterisk.org/6791|https://gerrit.asterisk.org/6791]

By: Friendly Automation (friendly-automation) 2017-10-15 14:30:20.363-0500

Change 6788 merged by Joshua Colp:
tcptls: NULL-check the parameter of ast_ssl_teardown before accessing it.

[https://gerrit.asterisk.org/6788|https://gerrit.asterisk.org/6788]