summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bind/lib/dns/ncache.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bind/lib/dns/ncache.c')
-rw-r--r--usr.sbin/bind/lib/dns/ncache.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/bind/lib/dns/ncache.c b/usr.sbin/bind/lib/dns/ncache.c
index 4f71c4f72bf..8ec80415d65 100644
--- a/usr.sbin/bind/lib/dns/ncache.c
+++ b/usr.sbin/bind/lib/dns/ncache.c
@@ -121,7 +121,10 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
ttl = maxttl;
trust = 0xffff;
isc_buffer_init(&buffer, data, sizeof(data));
- result = dns_message_firstname(message, DNS_SECTION_AUTHORITY);
+ if (message->counts[DNS_SECTION_AUTHORITY])
+ result = dns_message_firstname(message, DNS_SECTION_AUTHORITY);
+ else
+ result = ISC_R_NOMORE;
while (result == ISC_R_SUCCESS) {
name = NULL;
dns_message_currentname(message, DNS_SECTION_AUTHORITY,