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.
This commit is contained in:
anonimal 2017-02-21 14:38:22 +00:00
parent 95f59f8c1f
commit 5c3badb749
No known key found for this signature in database
GPG Key ID: 66A76ECF914409F1

View File

@ -478,6 +478,9 @@ namespace
bool load_txt_records_from_dns(std::vector<std::string> &good_records, const std::vector<std::string> &dns_urls) 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; std::vector<std::vector<std::string> > records;
records.resize(dns_urls.size()); records.resize(dns_urls.size());