Skip to content

Commit

Permalink
Restore old interface if TLS connection failed
Browse files Browse the repository at this point in the history
This was reported as creating a segfault in [0]

[0] profanity-im/profanity#1963

Signed-off-by: Steffen Jaeckel <[email protected]>
  • Loading branch information
sjaeckel committed Apr 10, 2024
1 parent 611889b commit 6b44b5b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,7 @@ int conn_tls_start(xmpp_conn_t *conn)
}

if (conn->tls != NULL) {
struct conn_interface old_intf = conn->intf;
conn->intf = tls_intf;
conn->intf.conn = conn;
if (tls_start(conn->tls)) {
Expand All @@ -1102,6 +1103,7 @@ int conn_tls_start(xmpp_conn_t *conn)
tls_free(conn->tls);
conn->tls = NULL;
conn->tls_failed = 1;
conn->intf = old_intf;
}
}
if (rc != 0) {
Expand Down

0 comments on commit 6b44b5b

Please sign in to comment.