]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
channel: Fix use after free in channel_do_open_actions()
authorDavid Goulet <dgoulet@torproject.org>
Tue, 23 Mar 2021 13:19:41 +0000 (09:19 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Tue, 23 Mar 2021 13:19:41 +0000 (09:19 -0400)
Fortunately, our tor_free() is setting the variable to NULL after so we were
in a situation where NULL was always used instead of the transport name.

This first appeared in 894ff2dc8422cb86312c512698acd76476224f87 and results in
basically no bridge with a transport being able to use DoS defenses.

Fixes #40345

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/ticket40345 [new file with mode: 0644]
src/core/or/channel.c

diff --git a/changes/ticket40345 b/changes/ticket40345
new file mode 100644 (file)
index 0000000..246e4a8
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes (channel, DoS):
+    - Fix a possible non fatal assertion BUG() due to a too early free of a
+      string when noting down the client connection for the DoS defenses
+      subsystem. Fixes bug 40345; bugfix on 0.4.3.4-rc
+
index 9194718e3d46abba88dd35b259680c232fe3303c..50c03de8468b1155766245d6bfb98074bd812230 100644 (file)
@@ -1887,11 +1887,11 @@ channel_do_open_actions(channel_t *chan)
         geoip_note_client_seen(GEOIP_CLIENT_CONNECT,
                                &remote_addr, transport_name,
                                now);
-        tor_free(transport_name);
         /* Notify the DoS subsystem of a new client. */
         if (tlschan && tlschan->conn) {
           dos_new_client_conn(tlschan->conn, transport_name);
         }
+        tor_free(transport_name);
       }
       /* Otherwise the underlying transport can't tell us this, so skip it */
     }