]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
tcptls: when disabling a server port, we should set the accept_fd to -1.
authorJaco Kroon <jaco@uls.co.za>
Fri, 2 Jun 2023 07:11:22 +0000 (09:11 +0200)
committerasterisk-org-access-app[bot] <120671045+asterisk-org-access-app[bot]@users.noreply.github.com>
Mon, 12 Jun 2023 14:07:32 +0000 (14:07 +0000)
If we don't set this to -1 if the structure can be potentially re-used
later then it's possible that we'll issue a close() on an unrelated file
descriptor, breaking asterisk in other interesting ways.

I believe this to be an unlikely scenario, but it costs nothing to be
safe.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
main/tcptls.c

index dc25cb4047fcc82a262421f185fc052b33820168..e51e70ef0d7cd43656a24c6600b8f3aa5adc376e 100644 (file)
@@ -837,6 +837,7 @@ void ast_tcptls_server_start(struct ast_tcptls_session_args *desc)
 
        if (desc->accept_fd != -1) {
                close(desc->accept_fd);
+               desc->accept_fd = -1;
        }
 
        /* If there's no new server, stop here */