From: Jaco Kroon Date: Fri, 2 Jun 2023 07:11:22 +0000 (+0200) Subject: tcptls: when disabling a server port, we should set the accept_fd to -1. X-Git-Tag: 18.19.0-rc1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4cc8497c61ffd28a9fa196ee6ca5d02782ebaba5;p=thirdparty%2Fasterisk.git tcptls: when disabling a server port, we should set the accept_fd to -1. 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 (cherry picked from commit 4e657b6181fb419d957f68698e057b2ca3b80254) --- diff --git a/main/tcptls.c b/main/tcptls.c index dc25cb4047..e51e70ef0d 100644 --- a/main/tcptls.c +++ b/main/tcptls.c @@ -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 */