summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dns.c7
-rw-r--r--src/test/Makefile.am6
-rw-r--r--src/test/Makefile.in13
-rw-r--r--src/test/datafile626
-rwxr-xr-xsrc/test/test6.sh7
5 files changed, 50 insertions, 9 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);
}
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 05439fa..3c5e0d2 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -1,9 +1,9 @@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
CLEANFILES = test*.log test*.trs \
- test2.out test4.out test4err.out key.pem cert.pem
+ test2.out test4.out test4err.out key.pem cert.pem test6.out
-TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh
+TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh
EXTRA_DIST = $(TESTS) \
- datafile datafile2 updatefile datafile3 datafile4 datafile5
+ datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6
diff --git a/src/test/Makefile.in b/src/test/Makefile.in
index fa6167e..78b3759 100644
--- a/src/test/Makefile.in
+++ b/src/test/Makefile.in
@@ -465,11 +465,11 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
CLEANFILES = test*.log test*.trs \
- test2.out test4.out test4err.out key.pem cert.pem
+ test2.out test4.out test4err.out key.pem cert.pem test6.out
-TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh
+TESTS = test1.sh test2.sh test3.sh test4.sh test5.sh test6.sh
EXTRA_DIST = $(TESTS) \
- datafile datafile2 updatefile datafile3 datafile4 datafile5
+ datafile datafile2 updatefile datafile3 datafile4 datafile5 datafile6
all: all-am
@@ -694,6 +694,13 @@ test5.sh.log: test5.sh
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+test6.sh.log: test6.sh
+ @p='test6.sh'; \
+ b='test6.sh'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
@p='$<'; \
$(am__set_b); \
diff --git a/src/test/datafile6 b/src/test/datafile6
new file mode 100644
index 0000000..8ed7df6
--- /dev/null
+++ b/src/test/datafile6
@@ -0,0 +1,26 @@
+\" A
+\001 A
+\". A
+a\". A
+\"a. A
+a\"a. A
+a\"a\". A
+\!\"a\". A
+\001. A
+a\001. A
+\001a. A
+a\001a. A
+a\001\001\001a. A
+a\001a\001a\001. A
+\".\". A
+a\".a\". A
+\"a.\"a. A
+a\"a.a\"a. A
+a\"a\".a\"a\". A
+\!\"a\".\!\"a\". A
+\001.\001. A
+a\001.a\001. A
+\001a.\001a. A
+a\001a.a\001a. A
+a\001\001\001a.a\001\001\001a. A
+a\001a\001a\001.a\001a\001a\001. A
diff --git a/src/test/test6.sh b/src/test/test6.sh
new file mode 100755
index 0000000..4eea79e
--- /dev/null
+++ b/src/test/test6.sh
@@ -0,0 +1,7 @@
+#!/bin/sh -xe
+
+test "$TEST_DNSPERF_WITH_NETWORK" = "1" || exit 0
+
+../dnsperf -vvv -d "$srcdir/datafile6" -s 1.1.1.1 >test6.out
+
+grep "NXDOMAIN 26" test6.out