[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 02/02: GNS: fix potential memory access violation
From: |
gnunet |
Subject: |
[gnunet] 02/02: GNS: fix potential memory access violation |
Date: |
Fri, 12 Jan 2024 13:28:06 +0100 |
This is an automated email from the git hooks/post-receive script.
sebi pushed a commit to branch master
in repository gnunet.
commit 749a3f960acd4074dd75e2075757341f76d0e00c
Author: Sebastian Nadler <sebastian.nadler@tum.de>
AuthorDate: Thu Jan 11 16:17:54 2024 +0100
GNS: fix potential memory access violation
---
src/service/gns/gnunet-service-gns_resolver.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/service/gns/gnunet-service-gns_resolver.c
b/src/service/gns/gnunet-service-gns_resolver.c
index 7af756aaf..0d7a1cee8 100644
--- a/src/service/gns/gnunet-service-gns_resolver.c
+++ b/src/service/gns/gnunet-service-gns_resolver.c
@@ -2397,7 +2397,16 @@ handle_gns_resolution_result (void *cls,
box = rd[i].data;
const char *prefix = rd[i].data + sizeof(struct
GNUNET_GNSRECORD_SBoxRecord);
- size_t prefix_len = strlen (prefix) + 1;
+ size_t prefix_len = strnlen (prefix, rd[i].data_size -
sizeof(struct
+
GNUNET_GNSRECORD_SBoxRecord))
+ + 1;
+ if (prefix_len - 1 >= rd[i].data_size - sizeof(struct
+
GNUNET_GNSRECORD_SBoxRecord))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SBOX record with invalid prefix length, maybe not
null-terminated\n");
+ continue;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got SBOX record, checking if prefixes match... %s vs
%s\n",
prefix, rh->prefix);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.