Skip to content

Commit 6b44b5b

Browse files
committed
Restore old interface if TLS connection failed
This was reported as creating a segfault in [0] [0] profanity-im/profanity#1963 Signed-off-by: Steffen Jaeckel <[email protected]>
1 parent 611889b commit 6b44b5b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/conn.c

+2
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,7 @@ int conn_tls_start(xmpp_conn_t *conn)
10921092
}
10931093

10941094
if (conn->tls != NULL) {
1095+
struct conn_interface old_intf = conn->intf;
10951096
conn->intf = tls_intf;
10961097
conn->intf.conn = conn;
10971098
if (tls_start(conn->tls)) {
@@ -1102,6 +1103,7 @@ int conn_tls_start(xmpp_conn_t *conn)
11021103
tls_free(conn->tls);
11031104
conn->tls = NULL;
11041105
conn->tls_failed = 1;
1106+
conn->intf = old_intf;
11051107
}
11061108
}
11071109
if (rc != 0) {

0 commit comments

Comments
 (0)