postgresql/src
Jacob Champion ff1d5810e9 Protect against small overread in SASLprep validation
(This is a cherry-pick of 390b3cbbb, which I hadn't realized wasn't
backpatched. It was originally reported to security@ and determined not
to be a vulnerability; thanks to Stanislav Osipov for noticing the
omission in the back branches.)

In case of torn UTF8 in the input data we might end up going
past the end of the string since we don't account for length.
While validation won't be performed on a sequence with a NULL
byte it's better to avoid going past the end to beging with.
Fix by taking the length into consideration.

Reported-by: Stanislav Osipov <stasos24@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAOYmi+mTnmM172g=_+Yvc47hzzeAsYPy2C4UBY3HK9p-AXNV0g@mail.gmail.com
Backpatch-through: 14
2026-02-06 11:09:05 -08:00
..
backend Fix various instances of undefined behavior 2026-02-04 17:59:18 +07:00
bin Fix some error message inconsistencies 2026-02-06 15:38:27 +09:00
common Protect against small overread in SASLprep validation 2026-02-06 11:09:05 -08:00
fe_utils In fmtIdEnc(), handle failure of enlargePQExpBuffer(). 2025-02-16 12:46:35 -05:00
include Fix trigger transition table capture for MERGE in CTE queries. 2026-01-24 11:30:51 +00:00
interfaces Fix printf format string warning on MinGW. 2025-12-21 21:01:25 +13:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl tests: Rename conflicting role names 2025-12-12 08:45:00 +09:00
port Fix POSIX compliance in pgwin32_unsetenv() for "name" argument 2025-10-21 08:08:40 +09:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:28:55 -04:00
test Fix logical replication TAP test to read publisher log correctly. 2026-02-05 00:47:10 +09:00
timezone Update time zone data files to tzdata release 2025c. 2026-01-18 14:55:07 -05:00
tools For inplace update, send nontransactional invalidations. 2025-12-16 16:13:55 -08:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:41 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
nls-global.mk Fix update-po for the PGXS case 2025-10-16 20:21:05 +02:00