Skip to content

CONN_is_IP_address(): prevent crash freeing uninitialized 'res' on unsuccessful getaddrinfo() call#69

Merged
DDvO merged 1 commit intomasterfrom
fix_crash_CONN_is_IP_address
Dec 19, 2025
Merged

CONN_is_IP_address(): prevent crash freeing uninitialized 'res' on unsuccessful getaddrinfo() call#69
DDvO merged 1 commit intomasterfrom
fix_crash_CONN_is_IP_address

Conversation

@DDvO
Copy link
Member

@DDvO DDvO commented Dec 19, 2025

This will prevent a crash reported by a genCMPClient user:

crash_CONN_is_IP_address

@DDvO DDvO added the bug Something isn't working label Dec 19, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a crash in the CONN_is_IP_address() function that occurs when getaddrinfo() fails and leaves the res pointer in an undefined state, which could then be incorrectly freed.

  • Initialize the res pointer to NULL to prevent undefined behavior
  • Change the condition for freeing memory from checking res != NULL to checking ret == 0 to properly handle getaddrinfo() return values

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

@DDvO DDvO changed the title CONN_is_IP_address(): prevent crash freeing uninitialized 'res' on unsuccessful getaddrinfo() call CONN_is_IP_address(): prevent crash freeing uninitialized 'res' on unsuccessful getaddrinfo() call Dec 19, 2025
@DDvO DDvO merged commit bd736ef into master Dec 19, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants