[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] In configured_nameserver_address, check if tor_addr_from_sockaddr succeeded



commit b7edfcbf6bb3a27d914ad883ae75413a4d25739a
Author: rl1987 <rl1987@xxxxxxxxxxxxxxxx>
Date:   Fri Oct 26 10:26:47 2018 +0300

    In configured_nameserver_address, check if tor_addr_from_sockaddr succeeded
---
 src/feature/relay/dns.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/feature/relay/dns.c b/src/feature/relay/dns.c
index dfd84652a..371c2f506 100644
--- a/src/feature/relay/dns.c
+++ b/src/feature/relay/dns.c
@@ -1381,8 +1381,11 @@ configured_nameserver_address(const size_t idx)
                                     (struct sockaddr *)&sa,
                                     sa_len) > 0) {
    tor_addr_t *tor_addr = tor_malloc(sizeof(tor_addr_t));
-   tor_addr_from_sockaddr(tor_addr, (const struct sockaddr *)&sa, NULL);
-   return tor_addr;
+   if (tor_addr_from_sockaddr(tor_addr,
+                              (const struct sockaddr *)&sa,
+                              NULL) == 0) {
+     return tor_addr;
+   }
  }
 
  return NULL;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits