aboutsummaryrefslogtreecommitdiff
path: root/src/or/ext_orport.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2013-06-27 17:50:56 +0300
committerNick Mathewson <nickm@torproject.org>2013-08-15 12:03:34 -0400
commitcb54e44587473782c2865c3ea4aca6e0666943a8 (patch)
treea99d97543a33d3fed4d5593cb07018aec412b193 /src/or/ext_orport.c
parent85c556a4c265f6ce9587c46d0040f57cb09618bc (diff)
downloadtor-cb54e44587473782c2865c3ea4aca6e0666943a8.tar
tor-cb54e44587473782c2865c3ea4aca6e0666943a8.tar.gz
Fix a number of issues with the #5040 code.
- Don't leak if a transport proxy sends us a TRANSPORT command more than once. - Don't use smartlist_string_isin() in geoip_get_transport_history(). (pointed out by Nick) - Use the 'join' argument of smartlist_join_strings() instead of trying to write the separator on our own. (pointed out by Nick) - Document 'ext_or_transport' a bit better. (pointed out by Nick) - Be a bit more consistent with the types of the values of 'transport_counts'. (pointed out by Nick)
Diffstat (limited to 'src/or/ext_orport.c')
-rw-r--r--src/or/ext_orport.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/or/ext_orport.c b/src/or/ext_orport.c
index f83002c18..8fd9b77c8 100644
--- a/src/or/ext_orport.c
+++ b/src/or/ext_orport.c
@@ -460,6 +460,12 @@ connection_ext_or_handle_cmd_transport(or_connection_t *conn,
return -1;
}
+ /* If ext_or_transport is already occupied (because the PT sent two
+ * TRANSPORT commands), deallocate the old name and keep the new
+ * one */
+ if (conn->ext_or_transport)
+ tor_free(conn->ext_or_transport);
+
conn->ext_or_transport = transport_str;
return 0;
}