pgsql: Avoid platform-specific null pointer dereference in psql.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Avoid platform-specific null pointer dereference in psql.
Дата
Msg-id E1i1xof-0001Dj-29@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c693c5c4904d9afdd97cbe414248583d57b59ce4

Modified Files
--------------
src/bin/psql/startup.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Back off output precision in circle.sql regression test.
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: pgsql: Fix optimization of foreign-key on update actions