I suppose it might be argued that it is not getaddrinfo()'s job to detect illegal invalid ports.
I'm not sure this stands up: the function is documented as being a single step to get from a host and/or service name to a (set of) addresses that can be used to connect. If this checking is not done here, then where should it be done? And what possible purpose could there be for allowing an invalid port into the result? -- Martin

