commit 1425549ca61cab8aa9476a25be0a31f726672bcc Author: rl1987 rl1987@sdf.lonestar.org Date: Sat Sep 1 21:22:47 2018 +0300
Code cleanups for tor_addr_parse() --- src/lib/net/address.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/lib/net/address.c b/src/lib/net/address.c index 17f4b1cf7..a87d4a36a 100644 --- a/src/lib/net/address.c +++ b/src/lib/net/address.c @@ -1189,13 +1189,13 @@ tor_addr_parse(tor_addr_t *addr, const char *src) struct in6_addr in6_tmp; int brackets_detected = 0;
+ tor_assert(addr && src); + size_t len = strlen(src);
- tor_assert(addr && src); - if (src[0] == '[' && src[1] && src[len - 1] == ']') { + if (len && src[0] == '[' && src[len - 1] == ']') { brackets_detected = 1; src = tmp = tor_strndup(src+1, strlen(src)-2); - len -= 2; }
if (tor_inet_pton(AF_INET6, src, &in6_tmp) > 0) {
tor-commits@lists.torproject.org