dns-packet
Advanced tools
Comparing version 1.3.2 to 1.3.3
10
index.js
@@ -77,3 +77,3 @@ var types = require('./types') | ||
name.encodingLength = function (n) { | ||
if (n === '.') return 1 | ||
if (n === '.' || n === '..') return 1 | ||
return Buffer.byteLength(n.replace(/^\.|\.$/gm, '')) + 2 | ||
@@ -693,3 +693,4 @@ } | ||
exports.encode = function (result, buf, offset) { | ||
if (!buf) buf = Buffer.allocUnsafe(exports.encodingLength(result)) | ||
var allocing = !buf | ||
if (allocing) buf = Buffer.allocUnsafe(exports.encodingLength(result)) | ||
if (!offset) offset = 0 | ||
@@ -714,2 +715,7 @@ | ||
// just a quick sanity check | ||
if (allocing && exports.encode.bytes !== buf.length) { | ||
return buf.slice(0, exports.encode.bytes) | ||
} | ||
return buf | ||
@@ -716,0 +722,0 @@ } |
{ | ||
"name": "dns-packet", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "An abstract-encoding compliant module for encoding / decoding DNS packets", | ||
@@ -5,0 +5,0 @@ "repository": { |
28424
768