summaryrefslogtreecommitdiff
path: root/tests/unit/unit1650.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-09-22 22:53:05 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-09-23 23:07:06 +0200
commitd5cbbe83973b8638210a6a90f250dfc0154898b3 (patch)
treed2801c6192dd73935854705693ab7634de7bf12b /tests/unit/unit1650.c
parentefc696a2e09225bfeab4e7efea61a4e416d66cba (diff)
downloadcurl-d5cbbe83973b8638210a6a90f250dfc0154898b3.tar.gz
unit1650: fix out of boundary access
Fixes #2987 Closes #3035
Diffstat (limited to 'tests/unit/unit1650.c')
-rw-r--r--tests/unit/unit1650.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/unit/unit1650.c b/tests/unit/unit1650.c
index a6278dd3c..b76936a97 100644
--- a/tests/unit/unit1650.c
+++ b/tests/unit/unit1650.c
@@ -268,12 +268,12 @@ UNITTEST_START
rc = doh_decode((unsigned char *)full49, sizeof(full49)-1,
DNS_TYPE_A, &d);
fail_if(d.numaddr != 1, "missing address");
- a = &d.addr[i];
- snprintf((char *)buffer, sizeof(buffer), "%d.%d.%d.%d\n",
+ a = &d.addr[0];
+ snprintf((char *)buffer, sizeof(buffer), "%d.%d.%d.%d",
a->ip.v4 & 0xff, (a->ip.v4>>8) & 0xff,
(a->ip.v4>>16) & 0xff, a->ip.v4 >>24);
- if(rc && strcmp((char *)buffer, "127.0.0.1")) {
- fprintf(stderr, "bad address decoded\n");
+ if(rc || strcmp((char *)buffer, "127.0.0.1")) {
+ fprintf(stderr, "bad address decoded: %s, rc == %d\n", buffer, rc);
return 7;
}
fail_if(d.numcname, "bad cname counter");