[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 02/03: GNS: Fix handling of labels starting with underscore in
From: |
gnunet |
Subject: |
[gnunet] 02/03: GNS: Fix handling of labels starting with underscore in GNS resolver |
Date: |
Fri, 15 Dec 2023 18:22:30 +0100 |
This is an automated email from the git hooks/post-receive script.
sebi pushed a commit to branch master
in repository gnunet.
commit 40cdbcfa71f9ca410bb43508ac3331c0adb28adc
Author: Sebastian Nadler <sebastian.nadler@tum.de>
AuthorDate: Fri Dec 15 16:30:12 2023 +0100
GNS: Fix handling of labels starting with underscore in GNS resolver
---
src/service/gns/gnunet-service-gns_resolver.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/service/gns/gnunet-service-gns_resolver.c
b/src/service/gns/gnunet-service-gns_resolver.c
index 2d80f79d9..d28d5e195 100644
--- a/src/service/gns/gnunet-service-gns_resolver.c
+++ b/src/service/gns/gnunet-service-gns_resolver.c
@@ -751,13 +751,15 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle
*rh)
/**
* If we have labels starting with underscore with label on
* the right, copy prefix to rh->prefix;
- * The format of `rh->name` must be "*._label",
- * where label is a string without '.'.
+ * The format of `rh->name` must be "*._label" or "_label",
+ * where label is a string without '.'
*/
if ((NULL != (dot = memrchr (rh->name,
(int) '.',
rh->name_resolution_pos)) && '_' == dot[1]) ||
- '_' == rh->name[0])
+ ((NULL == memrchr (rh->name,
+ (int) '.',
+ rh->name_resolution_pos)) && '_' == rh->name[0]))
{
rh->prefix = GNUNET_strndup (rh->name, rh->name_resolution_pos);
rh->name_resolution_pos = 0;
@@ -2393,7 +2395,8 @@ handle_gns_resolution_result (void *cls,
const struct GNUNET_GNSRECORD_SBoxRecord *box;
box = rd[i].data;
- char *prefix = GNUNET_strdup (&box[1]);
+ const char *prefix = rd[i].data + sizeof(struct
+ GNUNET_GNSRECORD_SBoxRecord);
size_t prefix_len = strlen (prefix) + 1;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got SBOX record, checking if prefixes match... %s vs
%s\n",
@@ -2406,12 +2409,11 @@ handle_gns_resolution_result (void *cls,
rd_new[rd_off].data_size -= sizeof(struct
GNUNET_GNSRECORD_SBoxRecord)
+ prefix_len;
- rd_new[rd_off].data = &rd[i].data[sizeof(struct
-
GNUNET_GNSRECORD_SBoxRecord)
- + prefix_len];
+ rd_new[rd_off].data = rd[i].data
+ + sizeof(struct
GNUNET_GNSRECORD_SBoxRecord)
+ + prefix_len;
rd_off++;
}
- GNUNET_free (prefix);
}
else
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.