]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
connection_or_set_identity_digest(): Make errors nonfatal.
authorNick Mathewson <nickm@torproject.org>
Tue, 1 Mar 2022 16:22:34 +0000 (11:22 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 1 Mar 2022 16:22:34 +0000 (11:22 -0500)
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.

src/core/or/connection_or.c

index e3e81ed9cb3d9000d619753d3177d4e164e183f2..a6f73d328ab8a56c75eaafac38b84b19ae5acbd2 100644 (file)
@@ -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;