diff options
Diffstat (limited to 'src/lib/util/dnsparser.c')
-rw-r--r-- | src/lib/util/dnsparser.c | 8 |
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 | } |