From: George Joseph Date: Fri, 6 Nov 2015 20:19:11 +0000 (-0700) Subject: dns: Use ntohl for ans->ttl in dns_parse_answer_ex X-Git-Tag: 14.0.0-beta1~587^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d82a4b098f41efe921b02440450e58320905360a;p=thirdparty%2Fasterisk.git dns: Use ntohl for ans->ttl in dns_parse_answer_ex dns_parse_answer_ex was not converting ans->ttl from network by order to host byte order which was causing certain ttls it to go negative. In turn this was causing answer edit checks to fail. ASTERISK-25528 #close Reported-by: Daniel Tryba Tested-by: George Joseph Change-Id: I31505132d6321c46d2f39fd06c20ee808a864037 --- diff --git a/main/dns.c b/main/dns.c index e1b7770bf5..c3b352d415 100644 --- a/main/dns.c +++ b/main/dns.c @@ -475,7 +475,7 @@ static int dns_parse_answer_ex(void *context, int rr_class, int rr_type, unsigne /* Skip over the records that do not have the same resource record class and type we care about */ if (ntohs(ans->class) == rr_class && ntohs(ans->rtype) == rr_type) { /* Invoke the record handler callback to deliver the discovered record */ - record_handler(context, answer, ntohs(ans->size), ans->ttl); + record_handler(context, answer, ntohs(ans->size), ntohl(ans->ttl)); /*At least one record was found */ ret = AST_DNS_SEARCH_SUCCESS; }