Re: [HACKERS] libpq port number handling

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] libpq port number handling
Date: 2009-09-25 00:36:08
Message-ID: 2497.1253838968@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Sam Mason <sam(at)samason(dot)me(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Haas 2009-09-25 00:41:24 Re: [HACKERS] libpq port number handling
Previous Message Lew 2009-09-25 00:17:43 Re: What is the difference of foreign key?

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-09-25 00:41:24 Re: [HACKERS] libpq port number handling
Previous Message Stef Walter 2009-09-25 00:32:34 Re: pg_hba.conf: samehost and samenet [REVIEW]