aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoranonimal <anonimal@i2pmail.org>2017-02-21 14:38:22 +0000
committeranonimal <anonimal@i2pmail.org>2017-02-21 14:38:22 +0000
commit5c3badb7492228ca6a73c273a98794f9e00fb88a (patch)
treeb325c42d4225fd4d6787f27a454fdc00aeb7896f /src
parentMerge pull request #1754 (diff)
downloadmonero-5c3badb7492228ca6a73c273a98794f9e00fb88a.tar.xz
dns_utils: fix infinite recursion when distributing empty dns_urls
load_txt_records_from_dns attempts to distribute `a = 0, b = -1` where (b = dns_urls.size() - 1) and IntType is signed integer. This results in an infinite recursion which leads to SIGSEGV.
Diffstat (limited to '')
-rw-r--r--src/common/dns_utils.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp
index f7655e3c7..19aae93da 100644
--- a/src/common/dns_utils.cpp
+++ b/src/common/dns_utils.cpp
@@ -478,6 +478,9 @@ namespace
bool load_txt_records_from_dns(std::vector<std::string> &good_records, const std::vector<std::string> &dns_urls)
{
+ // Prevent infinite recursion when distributing
+ if (dns_urls.empty()) return false;
+
std::vector<std::vector<std::string> > records;
records.resize(dns_urls.size());