Skip to content

dns: validate port range in setServers() - #65021

Open
Renegade334 wants to merge 1 commit into
nodejs:mainfrom
Renegade334:dns-validate-setservers-ports
Open

dns: validate port range in setServers()#65021
Renegade334 wants to merge 1 commit into
nodejs:mainfrom
Renegade334:dns-validate-setservers-ports

Conversation

@Renegade334

Copy link
Copy Markdown
Member

As per #65009 (review).

dns.setServers() currently has the following shenanigans with out-of-range port numbers:

  • uint16 overflow (seems version-/platform-dependent)
    dns.setServers(['1.2.3.4:65535','1.2.3.4:65536','1.2.3.4:65537'])dns.getServers()['1.2.3.4:65535','1.2.3.4','1.2.3.4:1']
  • process crash if >INT_MAX
    dns.setServers(['1.1.1.1:99999999999999999999999999'])// # node[1673753]: void node::cares_wrap::(anonymous namespace)::SetServers(const FunctionCallbackInfo<Value> &) at ../src/cares_wrap.cc:2164// # Assertion failed: portValue->Int32Value(env->context()).FromJust()

(the latter of these is not addressed by #65009)

Signed-off-by: Renegade334 <contact.9a5d6388@renegade334.me.uk>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-botnodejs-github-bot added dns Issues and PRs related to the dns subsystem. needs-ci PRs that need a full CI run. labels Aug 4, 2026
@Renegade334Renegade334 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Aug 4, 2026
@codecov

codecovBot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.30%. Comparing base (1576cb8) to head (16f5b73).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #65021 +/- ##
==========================================
- Coverage 90.30% 90.30% -0.01% 
==========================================
Files 759 759 Lines 247634 247636 +2 Branches 46684 46697 +13 ==========================================
- Hits 223630 223629 -1 - Misses 15467 15468 +1 - Partials 8537 8539 +2 
Files with missing linesCoverage Δ
lib/internal/dns/utils.js99.44% <100.00%> (+<0.01%)⬆️

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 4, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.dnsIssues and PRs related to the dns subsystem.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Renegade334@nodejs-github-bot@avivkeller