Skip to content

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

Reynald Bourtembourg requested to merge github/fork/bourtemb/master into master

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.

Edited by Damien Lacoste

Merge request reports