mafintosh / dns-packet

An abstract-encoding compliant module for encoding / decoding DNS packets
MIT License
207 stars 71 forks source link

Packet encoding fails: The value of "offset" is out of range. #63

Closed DSorlov closed 3 years ago

DSorlov commented 3 years ago

Experimenting a bit with creating packages using the encode method. The below package returns an error: _RangeError [ERR_OUT_OFRANGE]: The value of "offset" is out of range. It must be >= 0 and <= 971. Received 1013

const dnsPacket = require('dns-packet') const buf = dnsPacket.encode({ type: 'query', id: 23751, flags: 256, questions: [ { type: 'A', name: 'google.com' } ] })

Perhaps this is related to the issue here: https://github.com/mafintosh/dns-packet/issues/60

Stacktrace: _at Object.question.decode (C:\sources\lab\node_modules\dns-packet\index.js:1417:31) at decodeList (C:\sources\lab\node_modules\dns-packet\index.js:1537:19) at Object.exports.decode (C:\sources\lab\nodemodules\dns-packet\index.js:1477:12) at IncomingMessage. (C:\sources\lab\buildpacket.js:30:35)

DSorlov commented 3 years ago

Never mind, this was due to a memory/strcopy error on my part due to threading/semaphore issues.