| From: | Fujii Masao <fujii(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: psql: Fix out-of-bounds reads in prompt expansion |
| Date: | 2026-11-20 06:15:34 |
| Message-ID: | E1xUHuH-00000000TiR-3i1v@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
psql: Fix out-of-bounds reads in prompt expansion
psql could crash when a custom prompt contained a %:name: or
%`command` escape without its closing delimiter.
This happened because prompt expansion assumed that the closing
delimiter was present and read past the end of the prompt string
when it was missing.
Fix this by checking for the closing delimiter before advancing
past it.
Backpatch to all supported versions.
Author: Chao Li <lic(at)highgo(dot)com>
Reviewed-by: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Reviewed-by: Ishjaap Singh <ishjaap(dot)singh07(at)gmail(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/0B33F84F-6AA3-4A39-A45D-D8F31D4E44D8@gmail.com
Backpatch-through: 15
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/658a1cabed3f65c3e3cd3688454faea709d5ab2b
Modified Files
--------------
src/bin/psql/prompt.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-11-20 06:22:27 | pgsql: Fix parsing mode tracking when recycling datetime format cache e |
| Previous Message | Michael Paquier | 2026-11-20 05:44:53 | Re: pgsql: Forget the prefetcher's current record in XLogPrefetcherBeginRea |