Skip to content

WinSockNetEvents.c:1419 mirror of #716 item 5 (hostname truncation on Windows path) #721

Description

@jsavin

Rationale

PR #720 (closes #716 item 5) added a >255-byte hostname guard in Common/source/tcpverbs.c::tcp_address_to_name (the POSIX path). During /gate review, the bar-raiser flagged a sibling bug at Common/source/WinSockNetEvents.c:1419:

copyctopstring(h->h_name, domainName);

gethostbyname()'s h_name is unbounded by spec (limited by the resolver, easily > 255 bytes with long PTR/CNAME chains, NIS/LDAP-sourced names, or attacker-controlled reverse DNS). The ignored return value means a silent truncation — same identity-confusion threat model as #716 item 5.

Current State

WinSockNetEvents.c is the Windows port. It is not currently linked into the headless frontier-cli build (verified — no references in frontier-cli/Makefile or anywhere under frontier-cli/). So this is not a live bug today.

Desired Outcome

If/when the Windows path is revived (e.g., Windows port of headless Frontier, Windows-specific CLI build, full-app Windows revival), apply the same fix pattern PR #720 used for the POSIX path:

  1. Check copyctopstring's post-copyctopstring: silent truncation + buffer overflow risk on >255-byte input #707 boolean return
  2. On truncation, surface as log_warn with the IP but NOT the hostname (attacker-controlled string would be a log-injection vector)
  3. Fall back to a dotted-decimal IP string representation

Reference implementation: Common/source/tcpverbs.c::tcp_address_to_name_pack (added in PR #720).

Exit Criteria

  • If Windows path is revived, apply the same guard pattern to WinSockNetEvents.c:1419
  • If Windows path is permanently abandoned, this issue can be closed as wontfix

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2Medium priority - nice to havescope/easy4-8 hours, straightforward implementationworkstream/carbon-migrationCarbon dependency removal and modernization

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions