postgresql/src
Tom Lane 3b37e84422 Avoid fetching one past the end of translate()'s "to" parameter.
This is usually harmless, but if you were very unlucky it could
provoke a segfault due to the "to" string being right up against
the end of memory.  Found via valgrind testing (so we might've
found it earlier, except that our regression tests lacked any
exercise of translate()'s deletion feature).

Fix by switching the order of the test-for-end-of-string and
advance-pointer steps.  While here, compute "to_ptr + tolen"
just once.  (Smarter compilers might figure that out for
themselves, but let's just make sure.)

Report and fix by Daniil Anisimov, in bug #17816.

Discussion: https://postgr.es/m/17816-70f3d2764e88a108@postgresql.org
2023-03-01 11:30:17 -05:00
..
backend Avoid fetching one past the end of translate()'s "to" parameter. 2023-03-01 11:30:17 -05:00
bin Make EXEC_BACKEND more convenient on Linux and FreeBSD. 2023-02-08 13:09:49 +09:00
common Make EXEC_BACKEND more convenient on Linux and FreeBSD. 2023-02-08 13:09:49 +09:00
fe_utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
include Fix MULTIEXPR_SUBLINK with partitioned target tables, yet again. 2023-02-25 14:44:14 -05:00
interfaces Fix handling of SCRAM-SHA-256's channel binding with RSA-PSS certificates 2023-02-15 10:12:36 +09:00
makefiles
pl Translation updates 2023-02-06 12:18:46 +01:00
port Re-allow building on Microsoft Visual Studio 2013. 2022-11-10 10:23:49 -05:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:29:08 -04:00
test Avoid fetching one past the end of translate()'s "to" parameter. 2023-03-01 11:30:17 -05:00
timezone Update time zone data files to tzdata release 2022g. 2023-01-31 17:37:22 -05:00
tools Don't force SQL_ASCII/no-locale for installcheck in vcregress.pl 2023-02-26 06:55:42 -05:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Prevent port collisions between concurrent TAP tests 2022-11-22 10:52:24 -05:00
Makefile.shlib
nls-global.mk