pgsql: Avoid possible segfault in psql's tab completion.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid possible segfault in psql's tab completion.
Date: 2024-10-10 21:02:17
Message-ID: E1sz0Ib-000EEu-G8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid possible segfault in psql's tab completion.

Fix oversight in bd1276a3c: the "words_after_create" stanza in
psql_completion() requires previous_words_count > 0, since it uses
prev_wd. This condition was formerly assured by the if-else chain
above it, but no more. If there were no previous words then we'd
dereference an uninitialized pointer, possibly causing a segfault.

Report and patch by Anthonin Bonnefoy.

Discussion: https://postgr.es/m/CAO6_XqrSRE7c_i+D7Hm07K3+6S0jTAmMr60RY41XzaA29Ae5uA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/95eb4cd4ff0648afc32abbfaacc9718f6b91bf7b

Modified Files
--------------
src/bin/psql/tab-complete.in.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tatsuo Ishii 2024-10-11 00:58:26 Re: pgsql: Doc: add check to detect non-breaking spaces in the docs.
Previous Message Robert Haas 2024-10-10 17:45:58 Re: pgsql: Doc: add check to detect non-breaking spaces in the docs.