[COMMITTERS] pgsql: Fix double-free bug in GSS authentication.

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема [COMMITTERS] pgsql: Fix double-free bug in GSS authentication.
Дата
Msg-id E1dIUh6-0003RC-GE@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix double-free bug in GSS authentication.

The logic to free the buffer after the gss_init_sec_context() call was
always a bit wonky. Because gss_init_sec_context() sets the GSS context
variable, conn->gctx, we would in fact always attempt to free the buffer.
That only works, because previously conn->ginbuf.value was initialized to
NULL, and free(NULL) is a no-op. Commit 61bf96cab0 refactored things so
that the GSS input token buffer is allocated locally in pg_GSS_continue,
and not held in the PGconn object. After that, the now-local ginbuf.value
variable isn't initialized when it's not used, so we pass a bogus pointer
to free().

To fix, only try to free the input buffer if we allocated it. That was the
intention, certainly after the refactoring, and probably even before that.
But because there's no live bug before the refactoring, I refrained from
backpatching this.

The bug was also independently reported by Graham Dutton, as bug #14690.
Patch reviewed by Michael Paquier.

Discussion: https://www.postgresql.org/message-id/6288d80e-a0bf-d4d3-4e12-7b79c77f1771%40iki.fi
Discussion: https://www.postgresql.org/message-id/20170605130954.1438.90535%40wrigleys.postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3344582e6f1605d69bef008c4e489cafd9610cfe

Modified Files
--------------
src/interfaces/libpq/fe-auth.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: [COMMITTERS] pgsql: Consistently use subscription name as application name
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: [COMMITTERS] pgsql: Clear auth context correctly when re-connecting after failedaut