From c4d6658f4cfe5c5b153f59b0619f6c4ad8a47496 Mon Sep 17 00:00:00 2001 From: Riccardo Spagni Date: Fri, 3 Oct 2014 15:10:21 +0200 Subject: quick hacky fix for broken TXT reads --- src/common/dns_utils.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp index 0376ab9a9..8c4038568 100644 --- a/src/common/dns_utils.cpp +++ b/src/common/dns_utils.cpp @@ -31,6 +31,10 @@ #include #include +#include +#include "include_base_utils.h" +using namespace epee; + namespace tools { @@ -206,7 +210,11 @@ std::vector DNSResolver::get_txt_record(const std::string& url, boo { for (size_t i=0; result.ptr->data[i] != NULL; i++) { - records.push_back(result.ptr->data[i]); + // plz fix this, but this does NOT work and spills over into parts of memory it shouldn't: records.push_back(result.ptr->data[i]); + char *restxt; + restxt = (char*) calloc(result.ptr->len[i]+1, 1); + memcpy(restxt, result.ptr->data[i]+1, result.ptr->len[i]-1); + records.push_back(restxt); } } } -- cgit v1.2.3