]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
dns: Use ntohl for ans->ttl in dns_parse_answer_ex 85/1585/1
authorGeorge Joseph <george.joseph@fairview5.com>
Fri, 6 Nov 2015 20:19:11 +0000 (13:19 -0700)
committerGeorge Joseph <george.joseph@fairview5.com>
Fri, 6 Nov 2015 20:19:11 +0000 (13:19 -0700)
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

main/dns.c

index e1b7770bf57d4eeb1234d49f82322bfb701927cc..c3b352d415984c0ef97976d30d7697aded1b24e3 100644 (file)
@@ -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;
                }