chiark / gitweb /
Fix binary compatibility of string conversion of RRs with internl addr tables
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Dec 2016 01:49:35 +0000 (01:49 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 26 May 2020 19:24:04 +0000 (20:24 +0100)
Queries without adns__qtf_bigaddr use a smaller stride than the
size of our own adns_rr_addr.  This is dealt with by explicit
calculation of the addr struct using the stride from gsz_addr.

However, this circumlocution was omitted in cs_hostaddr, with the
result that adns_rr_info would go wrong for old clients.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/types.c

index 0c4860dc3a30c21de7bb86cea640bfe1447adf5f..b5f53c7f379cb39e0274a8a865290d0916239f35 100644 (file)
@@ -1007,6 +1007,7 @@ static adns_status csp_hostaddr(vbuf *vb, adns_rrtype rrt,
   adns_status st;
   char buf[20];
   int i;
+  size_t addrsz= gsz_addr(0, rrt);
 
   st= csp_domain(vb,rrp->host);  if (st) return st;
 
@@ -1026,7 +1027,7 @@ static adns_status csp_hostaddr(vbuf *vb, adns_rrtype rrt,
     CSP_ADDSTR(" (");
     for (i=0; i<rrp->naddrs; i++) {
       CSP_ADDSTR(" ");
-      st= csp_addr(vb,&rrp->addrs[i]);
+      st= csp_addr(vb, (const void*)((const char*)rrp->addrs + addrsz*i));
     }
     CSP_ADDSTR(" )");
   } else {