postgresql/src
Jacob Champion 5d61bdd114 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:08:24 -08:00
..
backend Add file_extend_method=posix_fallocate,write_zeros. 2026-02-06 17:41:42 +13:00
bin Fix some error message inconsistencies 2026-02-06 15:38:23 +09:00
common Protect against small overread in SASLprep validation 2026-02-06 11:08:24 -08:00
fe_utils In fmtIdEnc(), handle failure of enlargePQExpBuffer(). 2025-02-16 12:46:35 -05:00
include Add file_extend_method=posix_fallocate,write_zeros. 2026-02-06 17:41:42 +13:00
interfaces Fix printf format string warning on MinGW. 2025-12-21 21:28:12 +13:00
makefiles Optimize pg_popcount() with AVX-512 instructions. 2024-04-06 21:56:23 -05:00
pl Translation updates 2025-11-10 13:02:28 +01:00
port Fix O_CLOEXEC flag handling in Windows port. 2025-12-10 09:10:31 +13:00
template Remove AIX support 2024-02-28 15:17:23 +04:00
test Fix logical replication TAP test to read publisher log correctly. 2026-02-05 00:46:58 +09:00
timezone Update time zone data files to tzdata release 2025c. 2026-01-18 14:54:54 -05:00
tools For inplace update, send nontransactional invalidations. 2025-12-16 16:13:54 -08:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01: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 Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Fix update-po for the PGXS case 2025-10-16 20:21:05 +02:00