summaryrefslogtreecommitdiff
path: root/toxdns
diff options
context:
space:
mode:
Diffstat (limited to 'toxdns')
-rw-r--r--toxdns/toxdns.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/toxdns/toxdns.c b/toxdns/toxdns.c
index 79d2adbb..7a7a052d 100644
--- a/toxdns/toxdns.c
+++ b/toxdns/toxdns.c
@@ -26,6 +26,7 @@
26#endif 26#endif
27 27
28#include "../toxcore/Messenger.h" 28#include "../toxcore/Messenger.h"
29#include "../toxcore/logger.h"
29#include "toxdns.h" 30#include "toxdns.h"
30 31
31static const char base32[32] = {"abcdefghijklmnopqrstuvwxyz012345"}; 32static const char base32[32] = {"abcdefghijklmnopqrstuvwxyz012345"};
@@ -143,7 +144,7 @@ int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string
143 } 144 }
144 145
145 if (end_len != string - old_str) { 146 if (end_len != string - old_str) {
146 printf("tox_generate_dns3_string Fail, %u != %u\n", end_len, string - old_str); 147 LOGGER_ERROR("tox_generate_dns3_string Fail, %u != %lu\n", end_len, string - old_str);
147 return -1; 148 return -1;
148 } 149 }
149 150
@@ -216,8 +217,11 @@ int tox_decrypt_dns3_TXT(void *dns3_object, uint8_t *tox_id, uint8_t *id_record,
216 /*if (id_record_len > 255 || id_record_len <= (sizeof(uint32_t) + crypto_box_MACBYTES)) 217 /*if (id_record_len > 255 || id_record_len <= (sizeof(uint32_t) + crypto_box_MACBYTES))
217 return -1;*/ 218 return -1;*/
218 219
220 uint8_t id_record_null[id_record_len + 1];
221 memcpy(id_record_null, id_record, id_record_len);
222 id_record_null[id_record_len] = 0;
219 uint8_t data[id_record_len]; 223 uint8_t data[id_record_len];
220 int length = decode(data, id_record); 224 int length = decode(data, id_record_null);
221 225
222 if (length == -1) 226 if (length == -1)
223 return -1; 227 return -1;