]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pgcrypto: Fix check for buffer size
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Tue, 30 Jan 2024 10:15:46 +0000 (11:15 +0100)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Tue, 30 Jan 2024 10:15:46 +0000 (11:15 +0100)
commit375d30bcbbd07eb82144533fd4a30640af680e81
tree49304f0ec3f5744a35d33fa7279a7665a61cab03
parenteda1d0dfe681e9b87c06157e2b0b6864344944f1
pgcrypto: Fix check for buffer size

The code copying the PGP block into the temp buffer failed to
account for the extra 2 bytes in the buffer which are needed
for the prefix. If the block was oversized, subsequent checks
of the prefix would have exceeded the buffer size.  Since the
block sizes are hardcoded in the list of supported ciphers it
can be verified that there is no live bug here. Backpatch all
the way for consistency though, as this bug is old.

Author: Mikhail Gribkov <youzhick@gmail.com>
Discussion: https://postgr.es/m/CAMEv5_uWvcMCMdRFDsJLz2Q8g16HEa9xWyfrkr+FYMMFJhawOw@mail.gmail.com
Backpatch-through: v12
contrib/pgcrypto/pgp-decrypt.c