Files
node/lib
Jamie Davis 872c331a93 dns: improve setServers() errors and performance
Issue 1: make invalid setServers yield uniform error

Behavior:
dns.setServers throws a null pointer dereference on some inputs.
Expected behavior was the more pleasant
  TypeError [ERR_INVALID_IP_ADDRESS] ...

Root cause(s?):
- Dereferencing the result of a regex match without confirming
  that there was a match.
- assuming the capture of an optional group (?)

Solution:
Confirm the match, and handle a missing port cleanly.

Tests: I added tests for various unusual inputs.

Issue 2: revise quadratic regex in setServers

Problem:
The IPv6 regex was quadratic.
On long malicious input the event loop could block.

The security team did not deem it a security risk,
but said a PR was welcome.

Solution:
Revise the regex to a linear-complexity version.

Tests:
I added REDOS tests to the "oddities" section.

Fixes: https://github.com/nodejs/node/issues/20441
Fixes: https://github.com/nodejs/node/issues/20443

PR-URL: https://github.com/nodejs/node/pull/20445
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-06-08 21:35:32 -07:00
..
2018-04-13 19:59:44 +02:00
2018-03-05 19:51:30 +01:00
2018-05-18 15:25:42 +02:00
…
2018-06-06 19:43:52 +02:00
2018-06-01 11:01:45 +02:00
2018-04-03 13:57:41 -07:00
2018-04-16 16:02:12 +02:00
…
2018-05-18 15:25:40 +02:00
2018-05-18 15:32:05 +02:00
2018-04-26 19:42:48 +02:00
2018-06-05 18:57:44 -07:00