Module: kamailio
Branch: 6.0
Commit: 728776a3ad75d1d8f67b3f452d02c956a6f2da8e
URL: 
https://github.com/kamailio/kamailio/commit/728776a3ad75d1d8f67b3f452d02c956a6f2da8e

Author: Victor Seva <[email protected]>
Committer: Victor Seva <[email protected]>
Date: 2025-09-15T16:05:44+02:00

cdp: don't try to cleanup_ssl when no there's no tls info

> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x00007fa6326b3a95 in SSL_shutdown () from 
> /lib/x86_64-linux-gnu/libssl.so.3
> (gdb) bt
> #0  0x00007fa6326b3a95 in SSL_shutdown () from 
> /lib/x86_64-linux-gnu/libssl.so.3
> #1  0x00007fa6327582d5 in cleanup_ssl (tls_ctx=0x0, tls_conn=0x0) at 
> cdp_tls.c:259
> #2  0x00007fa6327a30a7 in receive_loop (original_peer=0x7fa612199860) at 
> receiver.c:890
> #3  0x00007fa63279b5cb in receiver_process (p=0x7fa612199860) at 
> receiver.c:485
> #4  0x00007fa63277e2b1 in diameter_peer_start (blocking=0) at 
> diameter_peer.c:294
> #5  0x00007fa63274ea8f in cdp_child_init (rank=0) at cdp_mod.c:275
> ...
> (gdb) p sp->tls_conn
> $5 = (SSL *) 0x0
> (gdb) p sp->tls_ctx
> $6 = (SSL_CTX *) 0x0

(cherry picked from commit cb0f9a9ac493201bad29e7f393e1c1b193bdd4b9)

---

Modified: src/modules/cdp/cdp_tls.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/728776a3ad75d1d8f67b3f452d02c956a6f2da8e.diff
Patch: 
https://github.com/kamailio/kamailio/commit/728776a3ad75d1d8f67b3f452d02c956a6f2da8e.patch

---

diff --git a/src/modules/cdp/cdp_tls.c b/src/modules/cdp/cdp_tls.c
index f2c7c7b8b63..7ecfa10dc00 100644
--- a/src/modules/cdp/cdp_tls.c
+++ b/src/modules/cdp/cdp_tls.c
@@ -256,9 +256,13 @@ SSL *init_ssl_conn(int client_fd, SSL_CTX *ctx)
 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
 void cleanup_ssl(SSL_CTX *tls_ctx, SSL *tls_conn)
 {
-       SSL_shutdown(tls_conn);
-       SSL_free(tls_conn);
-       SSL_CTX_free(tls_ctx);
+       if(tls_conn) {
+               SSL_shutdown(tls_conn);
+               SSL_free(tls_conn);
+       }
+       if(tls_ctx) {
+               SSL_CTX_free(tls_ctx);
+       }
 }
 #endif
 

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to