aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2022-03-01 11:22:34 -0500
committerNick Mathewson <nickm@torproject.org>2022-03-01 11:22:34 -0500
commit536b5c8059bc3356edb8687c423c5966a2729b6d (patch)
treeafbb1bf6e73b33d77b47eb8b741e00bd0c95ac00
parent92b4e4d04127bfdca4a3c869953e9fdf640729c7 (diff)
downloadtor-536b5c8059bc3356edb8687c423c5966a2729b6d.tar.gz
tor-536b5c8059bc3356edb8687c423c5966a2729b6d.zip
connection_or_set_identity_digest(): Make errors nonfatal.
Previously we were using tor_assert() to enforce the documented invariant here; this commit changes it to use BUG() instead. It will protect us from crashes if the next commit (on #40563) turns out to expose a bug somewhere.
-rw-r--r--src/core/or/connection_or.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
index e3e81ed9cb..a6f73d328a 100644
--- a/src/core/or/connection_or.c
+++ b/src/core/or/connection_or.c
@@ -182,8 +182,10 @@ connection_or_set_identity_digest(or_connection_t *conn,
const int ed_changed = ed_id_was_set &&
(!ed_id || !ed25519_pubkey_eq(ed_id, &chan->ed25519_identity));
- tor_assert(!rsa_changed || !rsa_id_was_set);
- tor_assert(!ed_changed || !ed_id_was_set);
+ if (BUG(rsa_changed && rsa_id_was_set))
+ return;
+ if (BUG(ed_changed && ed_id_was_set))
+ return;
if (!rsa_changed && !ed_changed)
return;