[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Early bailout from log_addr_has_changed() if running as client



commit ffdfd39d4fc693795f1e3fd222b676fe053681be
Author: rl1987 <rl1987@xxxxxxxxxxxxxxxx>
Date:   Thu Jul 26 17:49:27 2018 +0300

    Early bailout from log_addr_has_changed() if running as client
---
 changes/bug26892           | 6 ++++++
 src/feature/relay/router.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/changes/bug26892 b/changes/bug26892
new file mode 100644
index 000000000..6fc8a0320
--- /dev/null
+++ b/changes/bug26892
@@ -0,0 +1,6 @@
+  o Minor bugfixes (logging):
+    - As a precaution, do an early return from
+      log_addr_has_changed() if Tor is running as client. Also,
+      log a stack trace for debugging as this function should only
+      be called when Tor runs as server. Fixes bug 26892;
+      bugfix on 0.1.1.9-alpha.
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 973d3e110..0cc488723 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -2686,6 +2686,9 @@ log_addr_has_changed(int severity,
   char addrbuf_prev[TOR_ADDR_BUF_LEN];
   char addrbuf_cur[TOR_ADDR_BUF_LEN];
 
+  if (BUG(!server_mode(get_options())))
+    return;
+
   if (tor_addr_to_str(addrbuf_prev, prev, sizeof(addrbuf_prev), 1) == NULL)
     strlcpy(addrbuf_prev, "???", TOR_ADDR_BUF_LEN);
   if (tor_addr_to_str(addrbuf_cur, cur, sizeof(addrbuf_cur), 1) == NULL)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits