diff options
author | Neel Chauhan <neel@neelc.org> | 2020-04-26 13:06:11 -0700 |
---|---|---|
committer | teor <teor@torproject.org> | 2020-04-30 22:21:48 +1000 |
commit | 7bf257b1297d146047d10e0d527b45a88abf892a (patch) | |
tree | 47c2ed04c69e1582afdccec30936e84fef0effeb /src/core | |
parent | 7f9eaec538b7d01e0d1b130dc4cf2ec634252d46 (diff) | |
download | tor-7bf257b1297d146047d10e0d527b45a88abf892a.tar.gz tor-7bf257b1297d146047d10e0d527b45a88abf892a.zip |
Define and use TOR_ADDRPORT_BUF_LEN
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/or/channeltls.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c index 5cedd9fbca..a39d32606b 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; |