diff --git a/encode.js b/encode.js index d0aa06f..3be3324 100644 --- a/encode.js +++ b/encode.js @@ -119,6 +119,8 @@ State.prototype.record = function(section_name, record) { // Write the rdata. Update the position now (the rdata length value) in case self.encode() runs. var match, rdata + if(record.data === null) + return switch (record.class + ' ' + record.type) { case 'IN A': rdata = record.data || '' diff --git a/message.js b/message.js index 7d5a2fc..3c85f74 100644 --- a/message.js +++ b/message.js @@ -118,7 +118,7 @@ DNSMessage.prototype.toBinary = function() { msg[section] = msg[section] || [] msg[section].forEach(function(record) { - if(record.class != 'IN') + if(record.class != 'IN' || record.data === null) return // Make sure records promising data have data.