From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid platform-specific null pointer dereference in psql.
Date: Sun, 25 Aug 2019 19:04:41 +0000
Message-ID: <E1i1xof-0001De-1w@gemulon.postgresql.org> (raw)
Avoid platform-specific null pointer dereference in psql.
POSIX permits getopt() to advance optind beyond argc when the last
argv entry is an option that requires an argument and hasn't got one.
It seems that no major platforms actually do that, but musl does,
so that something like "psql -f" would crash with that libc.
Add a check that optind is in range before trying to look at the
possibly-bogus option.
Report and fix by Quentin Rameau. Back-patch to all supported
branches.
Discussion: https://postgr.es/m/20190825100617.GA6087@fifth.space
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/fb55e95396caa5f03dc37f72522313eb5c095ee1
Modified Files
--------------
src/bin/psql/startup.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Avoid platform-specific null pointer dereference in psql.
In-Reply-To: <E1i1xof-0001De-1w@gemulon.postgresql.org>
References: <E1i1xof-0001De-1w@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox