Socket
Socket
Sign inDemoInstall

native-node-dns-packet

Package Overview
Dependencies
6
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.4 to 0.1.5

2

package.json
{
"name": "native-node-dns-packet",
"version": "0.1.4",
"version": "0.1.5",
"authors": [

@@ -5,0 +5,0 @@ "Francis Turner <francis.turner@gmail.com>",

@@ -185,2 +185,33 @@ // Copyright 2011 Timothy J Fontaine <tjfontaine@gmail.com>

function writeTruncate(buff, packet, section, val) {
// From here to the "return" statement is a temporary patch that suffices
// until the "XXX FIXME TODO" issue below is fixed. When that's fixed,
// remove these lines.
//
// The RFC says that when the UDP response overflows, we should start
// dropping sections, starting from the end section (which may be
// optional info), until it fits, then set the TC bit if we've dropped
// essential data. However, the code below that tries to match the RFC's
// requirements is incomplete and throws an exception.
//
// Well-behaved clients retry via TCP when they see the TC bit. So a
// quick-and-dirty approach is to recreate the buffer, and write a new
// copy of the header with the TC bit set, and then end the response.
// This allows well-behaved clients to carry on and retry with TCP.
//
// Yes, there will be circumstances where the essential response data
// would fit and we could have dropped the optional response data, saving
// the retry. But, until this code is properly fixed, it's much better
// to respond a bit inefficiently instead of leaving the client hanging
// with no response at all.
buff = new BufferCursor(buff.buffer);
writeHeader(buff, packet);
const savedPosition = buff.tell();
buff.seek(2);
val = buff.readUInt16BE();
val |= (1 << 9) & 0x200;
buff.seek(2);
buff.writeUInt16BE(val);
buff.seek(savedPosition);
return WRITE_END;
// XXX FIXME TODO truncation is currently done wrong.

@@ -187,0 +218,0 @@ // Quote rfc2181 section 9

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc