terminate labels with null

This commit is contained in:
AJ ONeal 2017-10-19 12:53:56 -06:00
parent c6715ee6bf
commit b2dd53dcb1
3 changed files with 15 additions and 9 deletions

View File

@ -15,19 +15,21 @@ exports.DNS_PACKER_TYPE_CNAME = function (ab, dv, total, record) {
// RDATA
// a sequence of labels
record.data.split('.').forEach(function (label) {
cnameLen += 1 + label.length;
cnameLen += 1 + label.length;
dv.setUint8(total, label.length, false);
total += 1;
label.split('').forEach(function (ch) {
dv.setUint8(total, ch.charCodeAt(0), false);
dv.setUint8(total, label.length, false);
total += 1;
label.split('').forEach(function (ch) {
dv.setUint8(total, ch.charCodeAt(0), false);
total += 1;
});
});
dv.setUint8(total, 0x00, false);
total += 1;
// RDLENGTH
dv.setUint16(rdLenIndex, record.data.length + 1, false);
dv.setUint16(rdLenIndex, record.data.length + 2, false);
return total;
};

View File

@ -31,7 +31,7 @@ exports.DNS_PACKER_TYPE_MX = function (ab, dv, total, record) {
total += 1;
});
});
dv.setUint8(total, 0, false);
dv.setUint8(total, 0x00, false);
total += 1;
mxLen += 1;

View File

@ -59,6 +59,10 @@ exports.DNS_PACKER_TYPE_SRV = function (ab, dv, total, record) {
});
});
dv.setUint8(total, 0x00, false);
total += 1;
srvLen += 1;
// RDLENGTH
dv.setUint16(rdLenIndex, srvLen, false);