From 6e63d1ac44fe5bc976be13efdc59a9d0b243fdc3 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 7 Apr 2020 20:30:49 +0100 Subject: [PATCH] sel/bres-adns.c: Fix incorrect array bound. GCC helpfully points out that `N(av)' does nothing very useful. In fact, I expect that it's almost always zero, which means that we don't end up assembling addresses correctly. And we never have done. How embarrassing. (cherry picked from commit 5086ffd7745337f5bee3c5c771cfcf1da71b03c3) --- sel/bres-adns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sel/bres-adns.c b/sel/bres-adns.c index 0d93ab0..03fafa4 100644 --- a/sel/bres-adns.c +++ b/sel/bres-adns.c @@ -217,7 +217,7 @@ static void report(bres_client *rc, adns_answer *a, for (i = 0; i < nn && j < N(n) - 1; i++) if (strcmp(n[0], nv[i]) != 0) n[j++] = nv[i]; n[j++] = 0; - for (i = j = 0; i < an && j < N(av) - 1; i++) { + for (i = j = 0; i < an && j < N(aa) - 1; i++) { if (av[i].addr.sa.sa_family == AF_INET) aa[j++] = (char *)&av[i].addr.inet.sin_addr; } -- 2.11.0