gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 02/09: URI RR fix


From: gnunet
Subject: [gnunet] 02/09: URI RR fix
Date: Fri, 01 Dec 2023 10:26:49 +0100

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit f3415ad209686ca9b0bae3e13d6b2cb64c2cb620
Author: Sebastian Nadler <sebastian.nadler@tum.de>
AuthorDate: Thu Oct 26 11:52:59 2023 +0200

    URI RR fix
---
 src/lib/util/dnsparser.c | 8 ++++----
 1 file 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,
   uri = GNUNET_new (struct GNUNET_DNSPARSER_UriRecord);
   uri->priority = ntohs (uri_bin.prio);
   uri->weight = ntohs (uri_bin.weight);
-  GNUNET_asprintf(&(uri->target), "%.*s", udp_payload_length - sizeof(struct 
GNUNET_TUN_DnsUriRecord), &udp_payload[*off]);
-  (*off) += sizeof(uri->target) + 1;
+  int len =  GNUNET_asprintf(&(uri->target), "%.*s", udp_payload_length - 
sizeof(struct GNUNET_TUN_DnsUriRecord), &udp_payload[*off]);
+  (*off) += len;
   if (NULL == uri->target) // || GNUNET_STRINGS_parse_uri(uri->target, NULL, 
NULL) == GNUNET_NO)
   {
     GNUNET_DNSPARSER_free_uri (uri);
@@ -1258,8 +1258,8 @@ GNUNET_DNSPARSER_builder_add_uri (char *dst,
   sd.weight = htons (uri->weight);
   GNUNET_memcpy (&dst[*off], &sd, sizeof(sd));
   (*off) += sizeof(sd);
-  GNUNET_memcpy(&dst[*off], uri->target, sizeof(uri->target));
-  (*off) += sizeof(uri->target);
+  strncpy(&dst[*off], uri->target, dst_len - sizeof(struct 
GNUNET_TUN_DnsUriRecord) - 1);
+  (*off) += strlen(uri->target);
   dst[*off++] = '\0'; 
   return GNUNET_OK;
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]