Github user SolidWallOfCode commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/812#discussion_r71374450
  
    --- Diff: iocore/dns/DNS.cc ---
    @@ -1514,24 +1514,24 @@ dns_process(DNSHandler *handler, HostEnt *buf, int 
len)
             cp += dn_skipname(cp, eom);
             here     = cp; /* hack */
             SRV *srv = &buf->srv_hosts.hosts[num_srv];
    -        int r    = ink_ns_name_ntop(srv_off + SRV_SERVER, srv->host, 
MAXDNAME);
    -        if (r <= 0) {
    -          /* FIXME: is this really an error? or just a continue; */
    +
    +        // expand the name
    +        n = ink_dn_expand((u_char *)h, eom, srv_off + SRV_SERVER, (u_char 
*)srv->host, MAXDNAME);
    +        if (n < 0) {
               ++error;
    -          goto Lerror;
    +          break;
             }
             Debug("dns_srv", "Discovered SRV record [from NS lookup] with 
cost:%d weight:%d port:%d with host:%s",
                   ink_get16(srv_off + SRV_COST), ink_get16(srv_off + 
SRV_WEIGHT), ink_get16(srv_off + SRV_PORT), srv->host);
     
    -        srv->port        = ink_get16(srv_off + SRV_PORT);
    -        srv->priority    = ink_get16(srv_off + SRV_COST);
    -        srv->weight      = ink_get16(srv_off + SRV_WEIGHT);
    -        srv->host_len    = r;
    -        srv->host[r - 1] = '\0';
    -        srv->key         = makeHostHash(srv->host);
    +        srv->port     = ink_get16(srv_off + SRV_PORT);
    +        srv->priority = ink_get16(srv_off + SRV_COST);
    +        srv->weight   = ink_get16(srv_off + SRV_WEIGHT);
    +        srv->host_len = ::strlen(srv->host) + 1;
    --- End diff --
    
    Why the `+1`? I wouldn't think `host_len` should include the terminating 
null. Did it before when it was set to the return value of `ink_ns_name_ntop`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to