dns-packet
Advanced tools
Comparing version 5.2.2 to 5.2.3
11
index.js
@@ -80,3 +80,3 @@ 'use strict' | ||
name.encodingLength = function (n) { | ||
if (n === '.') return 1 | ||
if (n === '.' || n === '..') return 1 | ||
return Buffer.byteLength(n.replace(/^\.|\.$/gm, '')) + 2 | ||
@@ -1446,3 +1446,5 @@ } | ||
exports.encode = function (result, buf, offset) { | ||
if (!buf) buf = Buffer.allocUnsafe(exports.encodingLength(result)) | ||
const allocing = !buf | ||
if (allocing) buf = Buffer.allocUnsafe(exports.encodingLength(result)) | ||
if (!offset) offset = 0 | ||
@@ -1467,2 +1469,7 @@ | ||
// just a quick sanity check | ||
if (allocing && exports.encode.bytes !== buf.length) { | ||
return buf.slice(0, exports.encode.bytes) | ||
} | ||
return buf | ||
@@ -1469,0 +1476,0 @@ } |
{ | ||
"name": "dns-packet", | ||
"version": "5.2.2", | ||
"version": "5.2.3", | ||
"description": "An abstract-encoding compliant module for encoding / decoding DNS packets", | ||
@@ -5,0 +5,0 @@ "author": "Mathias Buus", |
55340
1507