sel/bres-adns.c: Fix incorrect array bound.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 7 Apr 2020 19:30:49 +0000 (20:30 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 May 2020 11:41:45 +0000 (12:41 +0100)
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

index 0d93ab0..03fafa4 100644 (file)
@@ -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;
   }