aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/channeltls.c
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2020-04-30 22:22:09 +1000
committerteor <teor@torproject.org>2020-04-30 22:22:09 +1000
commit6dc9930d3a14c30af0f285a884476f33a782938c (patch)
treecdfc6e78095427a32ae830c58d53b73da4506822 /src/core/or/channeltls.c
parentefcae919aea4611d9f4ec5815170c48fc67134cf (diff)
parent7bf257b1297d146047d10e0d527b45a88abf892a (diff)
downloadtor-6dc9930d3a14c30af0f285a884476f33a782938c.tar.gz
tor-6dc9930d3a14c30af0f285a884476f33a782938c.zip
Merge branch 'pr1870_squashed'
Diffstat (limited to 'src/core/or/channeltls.c')
-rw-r--r--src/core/or/channeltls.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index be941c1762..484727268c 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -564,10 +564,7 @@ channel_tls_get_transport_name_method(channel_t *chan, char **transport_out)
static const char *
channel_tls_get_remote_descr_method(channel_t *chan, int flags)
{
- /* IPv6 address, colon, port */
-#define MAX_DESCR_LEN (TOR_ADDR_BUF_LEN + 1 + 5)
-
- static char buf[MAX_DESCR_LEN + 1];
+ static char buf[TOR_ADDRPORT_BUF_LEN];
channel_tls_t *tlschan = BASE_CHAN_TO_TLS(chan);
connection_t *conn;
const char *answer = NULL;
@@ -580,15 +577,14 @@ channel_tls_get_remote_descr_method(channel_t *chan, int flags)
switch (flags) {
case 0:
/* Canonical address with port*/
- tor_snprintf(buf, MAX_DESCR_LEN + 1,
+ tor_snprintf(buf, TOR_ADDRPORT_BUF_LEN,
"%s:%u", conn->address, conn->port);
answer = buf;
break;
case GRD_FLAG_ORIGINAL:
/* Actual address with port */
addr_str = tor_addr_to_str_dup(&(tlschan->conn->real_addr));
- tor_snprintf(buf, MAX_DESCR_LEN + 1,
- "%s:%u", addr_str, conn->port);
+ tor_snprintf(buf, TOR_ADDRPORT_BUF_LEN, "%s:%u", addr_str, conn->port);
tor_free(addr_str);
answer = buf;
break;