summaryrefslogtreecommitdiffstats
path: root/src/dns.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-08-12 09:19:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-08-12 09:19:14 +0000
commitecc5838aff97659dd679f03edc8838205f868848 (patch)
tree85848124743d10e50adce2e36e3566b3d37b4ce7 /src/dns.c
parentAdding upstream version 2.6.0. (diff)
downloaddnsperf-ecc5838aff97659dd679f03edc8838205f868848.tar.xz
dnsperf-ecc5838aff97659dd679f03edc8838205f868848.zip
Adding upstream version 2.7.0.upstream/2.7.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/dns.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/dns.c b/src/dns.c
index b070eba..cf089a8 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -53,6 +53,7 @@ const char* perf_dns_rcode_strings[] = {
perf_result_t perf_dname_fromstring(const char* str, size_t len, perf_buffer_t* target)
{
size_t label_len, at;
+ ssize_t max = 255;
const char* orig_str = str;
bool is_quoted;
@@ -101,6 +102,10 @@ perf_result_t perf_dname_fromstring(const char* str, size_t len, perf_buffer_t*
if (label_len > 63) {
return PERF_R_FAILURE;
}
+ max -= label_len + 1;
+ if (max < 0) {
+ return PERF_R_FAILURE;
+ }
perf_buffer_putuint8(target, label_len);
if (is_quoted) {
for (at = 0; at < len; at++) {