aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Nadler <sebastian.nadler@tum.de>2023-10-26 11:52:59 +0200
committerSebastian Nadler <sebastian.nadler@tum.de>2023-11-30 19:33:48 +0100
commitf3415ad209686ca9b0bae3e13d6b2cb64c2cb620 (patch)
treedf514dde9304ec671840330e3f2858a33f5fbcde
parent4bbdc27dea7445bfa22af9b675b049ffc23b96b1 (diff)
downloadgnunet-f3415ad209686ca9b0bae3e13d6b2cb64c2cb620.tar.gz
gnunet-f3415ad209686ca9b0bae3e13d6b2cb64c2cb620.zip
URI RR fix
-rw-r--r--src/lib/util/dnsparser.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/util/dnsparser.c b/src/lib/util/dnsparser.c
index eb2d8a93b..5dc6dcf5b 100644
--- a/src/lib/util/dnsparser.c
+++ b/src/lib/util/dnsparser.c
@@ -552,8 +552,8 @@ GNUNET_DNSPARSER_parse_uri (const char *udp_payload,
552 uri = GNUNET_new (struct GNUNET_DNSPARSER_UriRecord); 552 uri = GNUNET_new (struct GNUNET_DNSPARSER_UriRecord);
553 uri->priority = ntohs (uri_bin.prio); 553 uri->priority = ntohs (uri_bin.prio);
554 uri->weight = ntohs (uri_bin.weight); 554 uri->weight = ntohs (uri_bin.weight);
555 GNUNET_asprintf(&(uri->target), "%.*s", udp_payload_length - sizeof(struct GNUNET_TUN_DnsUriRecord), &udp_payload[*off]); 555 int len = GNUNET_asprintf(&(uri->target), "%.*s", udp_payload_length - sizeof(struct GNUNET_TUN_DnsUriRecord), &udp_payload[*off]);
556 (*off) += sizeof(uri->target) + 1; 556 (*off) += len;
557 if (NULL == uri->target) // || GNUNET_STRINGS_parse_uri(uri->target, NULL, NULL) == GNUNET_NO) 557 if (NULL == uri->target) // || GNUNET_STRINGS_parse_uri(uri->target, NULL, NULL) == GNUNET_NO)
558 { 558 {
559 GNUNET_DNSPARSER_free_uri (uri); 559 GNUNET_DNSPARSER_free_uri (uri);
@@ -1258,8 +1258,8 @@ GNUNET_DNSPARSER_builder_add_uri (char *dst,
1258 sd.weight = htons (uri->weight); 1258 sd.weight = htons (uri->weight);
1259 GNUNET_memcpy (&dst[*off], &sd, sizeof(sd)); 1259 GNUNET_memcpy (&dst[*off], &sd, sizeof(sd));
1260 (*off) += sizeof(sd); 1260 (*off) += sizeof(sd);
1261 GNUNET_memcpy(&dst[*off], uri->target, sizeof(uri->target)); 1261 strncpy(&dst[*off], uri->target, dst_len - sizeof(struct GNUNET_TUN_DnsUriRecord) - 1);
1262 (*off) += sizeof(uri->target); 1262 (*off) += strlen(uri->target);
1263 dst[*off++] = '\0'; 1263 dst[*off++] = '\0';
1264 return GNUNET_OK; 1264 return GNUNET_OK;
1265} 1265}