Re: libpq port number handling - Mailing list pgsql-hackers

From Tom Lane
Subject Re: libpq port number handling
Date
Msg-id 2497.1253838968@sss.pgh.pa.us
Whole thread Raw
In response to libpq port number handling  (Sam Mason <sam@samason.me.uk>)
Responses Re: libpq port number handling
Re: [GENERAL] libpq port number handling
List pgsql-hackers
Sam Mason <sam@samason.me.uk> writes:
> Hum, why is PG doing an (unchecked) atoi on the user specified port
> rather than leaving it up to getaddrinfo to resolve the port?  It would
> seem to require changing UNIXSOCK_PATH to accept a string as the "port
> number", which is probably a bit much of a change.
> The included doesn't feel very nice, but is probably more acceptable.

I had been thinking about applying strstr to insist that the string
contain only digits (and maybe spaces), but the range check you suggest
is probably more useful.  Anyone have objections?  (BTW, are port
numbers still limited to 16 bits in IPv6?  If not then this won't do.)

            regards, tom lane

pgsql-hackers by date:

Previous
From: Stef Walter
Date:
Subject: Re: pg_hba.conf: samehost and samenet [REVIEW]
Next
From: Robert Haas
Date:
Subject: Re: libpq port number handling