]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a boolean logic error when logging about invalid hostnames.
authorNick Mathewson <nickm@torproject.org>
Wed, 6 May 2020 21:15:37 +0000 (17:15 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 6 May 2020 21:15:37 +0000 (17:15 -0400)
Fixes bug 34131; bugfix on 0.4.3.1-alpha.

changes/bug34131 [new file with mode: 0644]
src/core/or/connection_edge.c

diff --git a/changes/bug34131 b/changes/bug34131
new file mode 100644 (file)
index 0000000..eb3a3fe
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes (logging):
+    - Fix a logic error in a log message about whether an address was
+      invalid. Previously, the code would never report that onion addresses
+      were onion addresses. Fixes bug 34131; bugfix on 0.4.3.1-alpha.
index 7f707a56608de15a73f3ad9df1a39372eb43dc21..37e83ba71eddd9945ddb1d89332b0199dea37324 100644 (file)
@@ -1643,9 +1643,11 @@ parse_extended_hostname(char *address, hostname_type_t *type_out)
  failed:
   /* otherwise, return to previous state and return 0 */
   *s = '.';
+  const bool is_onion = (*type_out == ONION_V2_HOSTNAME) ||
+    (*type_out == ONION_V3_HOSTNAME);
   log_warn(LD_APP, "Invalid %shostname %s; rejecting",
-      (*type_out == (ONION_V2_HOSTNAME || ONION_V3_HOSTNAME) ? "onion " : ""),
-      safe_str_client(address));
+           is_onion ? "onion " : "",
+           safe_str_client(address));
   return false;
 }