Content-Length: 261552 | pFad | http://github.com/postgrespro/postgres/commit/b527ebc1d37aa82b771dc9c76111bed1bce35a05

F4 pgcrypto: Fix check for buffer size · postgrespro/postgres@b527ebc · GitHub
Skip to content

Commit b527ebc

Browse files
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
1 parent 4c48c0f commit b527ebc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/pgcrypto/pgp-decrypt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ prefix_init(void **priv_p, void *arg, PullFilter *src)
250250
uint8 tmpbuf[PGP_MAX_BLOCK + 2];
251251

252252
len = pgp_get_cipher_block_size(ctx->cipher_algo);
253-
if (len > sizeof(tmpbuf))
253+
/* Make sure we have space for prefix */
254+
if (len > PGP_MAX_BLOCK)
254255
return PXE_BUG;
255256

256257
res = pullf_read_max(src, len + 2, &buf, tmpbuf);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/b527ebc1d37aa82b771dc9c76111bed1bce35a05

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy