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

[tor-commits] [tor/maint-0.4.3] Fix a boolean logic error when logging about invalid hostnames.



commit b444096be5ac509be1b2b68dc8e18ca1f558fef5
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed May 6 17:15:37 2020 -0400

    Fix a boolean logic error when logging about invalid hostnames.
    
    Fixes bug 34131; bugfix on 0.4.3.1-alpha.
---
 changes/bug34131              | 4 ++++
 src/core/or/connection_edge.c | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/changes/bug34131 b/changes/bug34131
new file mode 100644
index 000000000..eb3a3feba
--- /dev/null
+++ b/changes/bug34131
@@ -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.
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index 7f707a566..37e83ba71 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -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;
 }
 

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