[COMMITTERS] pgsql: Fix misparsing of non-newline-terminated pg_hba.conf files.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема [COMMITTERS] pgsql: Fix misparsing of non-newline-terminated pg_hba.conf files.
Дата
Msg-id E1e4UWb-0001se-DM@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix misparsing of non-newline-terminated pg_hba.conf files.

This back-patches the v10-cycle commit 1e5a5d03d into 9.3 - 9.6.
I had noticed at the time that that was fixing a bug, namely that
next_token() might advance *lineptr past the line-terminating '\0',
but given the lack of field complaints I too easily convinced myself
that the problem was only latent.  It's not, because tokenize_file()
decides whether there's more on the line using "strlen(lineptr)".

The bug is indeed latent on a newline-terminated line, because then
the newline-stripping bit in tokenize_file() means we'll have two
or more consecutive '\0's in the buffer, masking the fact that we
accidentally advanced over the first one.  But the last line in
the file might not be null-terminated, allowing the loop to see
and process garbage, as reported by Mark Jones in bug #14859.

The bug doesn't exist in <= 9.2; there next_token() is reading directly
from a file, and termination of the outer loop relies on an feof() test
not a buffer pointer check.  Probably commit 7f49a67f9 can be blamed
for this bug, but I didn't track it down exactly.

Commit 1e5a5d03d does a bit more than the minimum needed to fix the
bug, but I felt the rest of it was good cleanup, so applying it all.

Discussion: https://postgr.es/m/20171017141814.8203.27280@wrigleys.postgresql.org

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9e20276e13c2fd04396d5178de7210a2179cd347

Modified Files
--------------
src/backend/libpq/hba.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)


--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Fix traversal of half-frozen update chains
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Fix traversal of half-frozen update chains