]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Bug 40828: Add more log scrubbing to protocol warnings
authorMike Perry <mikeperry-git@torproject.org>
Mon, 31 Jul 2023 14:12:39 +0000 (14:12 +0000)
committerMike Perry <mikeperry-git@torproject.org>
Mon, 31 Jul 2023 14:12:39 +0000 (14:12 +0000)
src/core/mainloop/mainloop.c
src/core/or/relay.c
src/feature/hs/hs_common.c
src/feature/relay/relay_find_addr.c

index 3702f3a74ed19d6ce5dd31dc20dcb1f8587478f6..658b4b47ee3f9426a541d3912ddbed25034cb6c4 100644 (file)
@@ -1271,8 +1271,8 @@ run_connection_housekeeping(int i, time_t now)
     log_fn(LOG_PROTOCOL_WARN,LD_PROTOCOL,
            "Expiring stuck OR connection to fd %d (%s:%d). (%d bytes to "
            "flush; %d seconds since last write)",
-           (int)conn->s, fmt_and_decorate_addr(&conn->addr), conn->port,
-           (int)connection_get_outbuf_len(conn),
+           (int)conn->s, safe_str(fmt_and_decorate_addr(&conn->addr)),
+           conn->port, (int)connection_get_outbuf_len(conn),
            (int)(now-conn->timestamp_last_write_allowed));
     connection_or_close_normally(TO_OR_CONN(conn), 0);
   } else if (past_keepalive && !connection_get_outbuf_len(conn)) {
index 2c722f01cc48f63988f7a9f0ac1135b4df688413..3af9435a76381604bfd954fc7630a80b391816e4 100644 (file)
@@ -1469,7 +1469,7 @@ connection_edge_process_relay_cell_not_open(
           (get_options()->ClientDNSRejectInternalAddresses &&
            tor_addr_is_internal(&addr, 0))) {
         log_info(LD_APP, "...but it claims the IP address was %s. Closing.",
-                 fmt_addr(&addr));
+                 safe_str(fmt_addr(&addr)));
         connection_edge_end(conn, END_STREAM_REASON_TORPROTOCOL);
         connection_mark_unattached_ap(entry_conn,
                                       END_STREAM_REASON_TORPROTOCOL);
@@ -1480,7 +1480,7 @@ connection_edge_process_relay_cell_not_open(
           (family == AF_INET6 && ! entry_conn->entry_cfg.ipv6_traffic)) {
         log_fn(LOG_PROTOCOL_WARN, LD_APP,
                "Got a connected cell to %s with unsupported address family."
-               " Closing.", fmt_addr(&addr));
+               " Closing.", safe_str(fmt_addr(&addr)));
         connection_edge_end(conn, END_STREAM_REASON_TORPROTOCOL);
         connection_mark_unattached_ap(entry_conn,
                                       END_STREAM_REASON_TORPROTOCOL);
index 65473721615fe52c44cc0c0b6e49e6105d583ea0..cd7e4890d184d56d434fa62ac37782b5a4f8f3a8 100644 (file)
@@ -1680,7 +1680,7 @@ hs_get_extend_info_from_lspecs(const smartlist_t *lspecs,
   if (!extend_info_addr_is_allowed(&ap.addr)) {
     log_fn(LOG_PROTOCOL_WARN, LD_REND,
            "Requested address is private and we are not allowed to extend to "
-           "it: %s:%u", fmt_addr(&ap.addr), ap.port);
+           "it: %s:%u", safe_str(fmt_addr(&ap.addr)), ap.port);
     goto done;
   }
 
index 5a32283a7b709fbb63401248391597da88746867..106117b236e5c2527c7c26a42e325a62e6c08e2c 100644 (file)
@@ -78,7 +78,7 @@ relay_address_new_suggestion(const tor_addr_t *suggested_addr,
     /* Do not believe anyone who says our address is their address. */
     log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
            "A relay endpoint %s is telling us that their address is ours.",
-           fmt_addr(peer_addr));
+           safe_str(fmt_addr(peer_addr)));
     return;
   }