In some cases, on some older BSD versions (and macOS versions based on
that code) getaddrinfo() crashes when given ai_flags = AI_NUMERICSERV
together with either a nullptr or the literal string "0" for the
servname parameter.
In the case of OpenInet6() it seems that there is no useful case when
we could have an empty name (and we ignore the port number passed when
calling getaddrinfo).
The change here diagnoses a missing server name early, and then calls the
getaddrinfo() with ai_flags = 0 and a nullptr for servname.
We do check the validity of the port number in the next section of the
code that carries out the connect.
When applied to the GCC implementation of P1184, this fixes the remaining
fails on the affected macOS versions.
…ons.
In some cases, on some older BSD versions (and macOS versions based on that code) getaddrinfo() crashes when given ai_flags = AI_NUMERICSERV together with either a nullptr or the literal string "0" for the servname parameter.
In the case of OpenInet6() it seems that there is no useful case when we could have an empty name (and we ignore the port number passed when calling getaddrinfo).
The change here diagnoses a missing server name early, and then calls the getaddrinfo() with ai_flags = 0 and a nullptr for servname.
We do check the validity of the port number in the next section of the code that carries out the connect.
When applied to the GCC implementation of P1184, this fixes the remaining fails on the affected macOS versions.