Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Fix crash when getaddrinfo is returning several struct addrinfo (#6) #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bourtemb
Copy link
Member

@bourtemb bourtemb commented Jan 7, 2020

The second struct addrinfo contains a field ai-canonname which is NULL.
This caused a crash because some code was attempting to create a string
from a null pointer.

getaddrinfo man page (on Debian Buster) says the following:

If hints.ai_flags includes the AI_CANONNAME flag, then the ai_canon-
name field of the first of the addrinfo structures in the returned
list is set to point to the official name of the host.

So there is no need to look at the following addrinfo returned structures.

…o-controls-hdbpp#6)

The second struct addrinfo contains a field ai-canonname which is NULL.
This caused a crash because some code was attempting to create a string
from a null pointer.

getaddrinfo man page (on Debian Buster) says the following:

    If hints.ai_flags includes the AI_CANONNAME flag, then the ai_canon-
    name field of the first of the addrinfo structures in the returned
    list is set to point to the official name of the host.

So there is no need to look at the following addrinfo returned structures.
@bourtemb bourtemb requested a review from gscalam January 7, 2020 17:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant