attributes = DNS_NAMEATTR_CNAME;
else if (covers == dns_rdatatype_dname)
attributes = DNS_NAMEATTR_DNAME;
- else if (covers == 0) {
+ else if (covers == 0 &&
+ sectionid == DNS_SECTION_ADDITIONAL)
+ {
if (msg->sig0 != NULL) {
result = DNS_R_FORMERR;
goto cleanup;
skip_name_search) {
if (rdtype != dns_rdatatype_opt &&
rdtype != dns_rdatatype_tsig &&
- !(rdtype == dns_rdatatype_sig && covers == 0))
+ !(rdtype == dns_rdatatype_sig && covers == 0 &&
+ sectionid == DNS_SECTION_ADDITIONAL))
{
ISC_LIST_APPEND(*section, name, link);
free_name = ISC_FALSE;
/*
* If this is an SIG(0) or TSIG record, remember it.
*/
- if (rdtype == dns_rdatatype_sig && covers == 0) {
+ if (rdtype == dns_rdatatype_sig && covers == 0 &&
+ sectionid == DNS_SECTION_ADDITIONAL)
+ {
msg->sig0 = rdataset;
rdataset = NULL;
free_rdataset = ISC_FALSE;
INSIST(result == ISC_R_SUCCESS);
dns_rdataset_current(msg->sig0, &rdata);
+ if (rdata.length == 0)
+ return (ISC_R_UNEXPECTEDEND);
result = dns_rdata_tostruct(&rdata, &sig, msg->mctx);
if (result != ISC_R_SUCCESS)
return (result);