summaryrefslogtreecommitdiffstats
path: root/src/dns.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-10-08 08:43:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-10-08 08:43:44 +0000
commitea1f8f1b6b3e7d8ead3758723b9aae08be758f0a (patch)
tree49f764f6134f55cb76b1577c9152deaabd6a58dc /src/dns.c
parentAdding upstream version 2.7.0. (diff)
downloaddnsperf-ea1f8f1b6b3e7d8ead3758723b9aae08be758f0a.tar.xz
dnsperf-ea1f8f1b6b3e7d8ead3758723b9aae08be758f0a.zip
Adding upstream version 2.7.1.upstream/2.7.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/dns.c')
-rw-r--r--src/dns.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dns.c b/src/dns.c
index cf089a8..8c4999f 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -111,12 +111,11 @@ perf_result_t perf_dname_fromstring(const char* str, size_t len, perf_buffer_t*
for (at = 0; at < len; at++) {
if (*(str + at) == '\\') {
at++;
- if (at >= len)
- return PERF_R_FAILURE;
if (*(str + at) >= '0' && *(str + at) <= '9') {
char b[4];
long v;
- memcpy(b, str, 3);
+ memcpy(b, str + at, 3);
+ at += 2;
b[3] = 0;
v = strtol(b, 0, 7);
if (v < 0 || v > 255)
@@ -124,6 +123,8 @@ perf_result_t perf_dname_fromstring(const char* str, size_t len, perf_buffer_t*
perf_buffer_putuint8(target, (uint8_t)v);
continue;
}
+ } else if (*(str + at) == '.') {
+ break;
}
perf_buffer_putmem(target, str + at, 1);
}