only add compression pointer length once

This commit is contained in:
AJ ONeal 2017-02-11 09:54:27 -07:00
parent 8148e25d18
commit 7f673f6fbf
2 changed files with 5 additions and 5 deletions

View File

@ -106,9 +106,6 @@ pdns.unpack = function (ab) {
q.className = classes[q.class]; q.className = classes[q.class];
q.typeName = types[q.type]; q.typeName = types[q.type];
// console.log('*********************');
// console.log(q.typeName);
return q; return q;
} }
@ -129,7 +126,7 @@ pdns.unpack = function (ab) {
//, rdata: 0 //, rdata: 0
, rdlength: 0 , rdlength: 0
}); });
//console.log('unpackAnswer QNAME:'); //console.log('unpackAnswer [Q]NAME:');
//console.log(q); //console.log(q);
total += q.byteLength; total += q.byteLength;
q.className = classes[q.class]; q.className = classes[q.class];
@ -171,6 +168,7 @@ pdns.unpack = function (ab) {
total += q.rdlength; total += q.rdlength;
q.byteLength = total - ototal; q.byteLength = total - ototal;
return q; return q;
} }

View File

@ -34,8 +34,10 @@ exports.DNS_UNPACK_LABELS = function (ui8, ptr, q) {
// we're not coming back! // we're not coming back!
ptr = cpptr; ptr = cpptr;
if (!q.cpcount) {
q.byteLength += 2; // cp and len
}
q.cpcount += 1; q.cpcount += 1;
q.byteLength += 2; // cp and len
// recursion // recursion
return exports.DNS_UNPACK_LABELS(ui8, ptr, q); return exports.DNS_UNPACK_LABELS(ui8, ptr, q);