postgresql/src
Heikki Linnakangas 3344582e6f 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
2017-06-07 09:42:29 +03:00
..
backend Consistently use subscription name as application name 2017-06-06 22:11:22 -04:00
bin Fix some cases of "the the" split across two lines. 2017-06-06 12:24:44 -04:00
common Post-PG 10 beta1 pgperltidy run 2017-05-17 19:01:23 -04:00
fe_utils Allow psql variable substitution to occur in backtick command strings. 2017-04-01 21:44:54 -04:00
include Unify SIGHUP handling between normal and walsender backends. 2017-06-05 19:18:16 -07:00
interfaces Fix double-free bug in GSS authentication. 2017-06-07 09:42:29 +03:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:55 -04:00
pl Update expected file 2017-05-25 14:41:43 -04:00
port Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
template Remove "sco" and "unixware" ports. 2016-10-11 11:26:04 -04:00
test Clean up latch related code. 2017-06-06 16:13:00 -07:00
timezone Guard against null t->tm_zone in strftime.c. 2017-05-07 12:33:12 -04:00
tools Fix thinko in previous openssl change 2017-06-05 20:38:46 -04:00
tutorial Recommend wrappers of PG_DETOAST_DATUM_PACKED(). 2017-03-12 19:35:33 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Remove redundant coverage target 2017-02-17 08:56:57 -05:00
Makefile.global.in Specify --outputdir for isolation install check, not just plain check. 2017-05-13 15:13:17 -07:00
Makefile.shlib Remove support for bcc and msvc standalone libpq builds 2017-04-11 15:22:21 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00