Skip to content

Clear the sockaddr_in6 structure before use - #20885

Closed
vlmarek wants to merge 1 commit into
curl:masterfrom
vlmarek:master
Closed

vlmarek wants to merge 1 commit into
curl:masterfrom
vlmarek:master

Conversation

@vlmarek

@vlmarek vlmarek commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

On Solaris this was causing intermittent issues when the private structure member __sin6_src_id had unexpectedly some value. connect(2) would then fail with EADDRNOTAVAIL.

This patch was used on Solaris builds for last two years: https://github.com/oracle/solaris-userland/blob/master/components/curl/patches/34396154.patch

I have modified it slightly to match what the function get_localhost below does.

Thank you for curl.

On Solaris this was causing intermittent issues when the private
structure member __sin6_src_id had unexpectedly some value. connect(2)
would then fail with EADDRNOTAVAIL.
@github-actions github-actions Bot added the name lookup DNS and related tech label Mar 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes intermittent Solaris IPv6 localhost connection failures by ensuring the sockaddr_in6 used for ::1 is fully zero-initialized before fields are set (avoiding stray values in platform-private members like __sin6_src_id).

Changes:

  • Zero-initialize struct sockaddr_in6 sa6 in get_localhost6() before populating its fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@bagder bagder closed this in 015f1c7 Mar 11, 2026
@bagder

bagder commented Mar 11, 2026

Copy link
Copy Markdown
Member

Thanks!

outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
On Solaris this was causing intermittent issues when the private
structure member __sin6_src_id had unexpectedly some value. connect(2)
would then fail with EADDRNOTAVAIL.

Closes curl#20885
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

name lookup DNS and related tech

Development

Successfully merging this pull request may close these issues.

3 participants