diff options
author | Peter Eisentraut | 2021-03-23 10:35:12 +0000 |
---|---|---|
committer | Peter Eisentraut | 2021-03-23 10:48:37 +0000 |
commit | 22e1943f13b66df22ea4f8d15836411ba259263a (patch) | |
tree | b22bcb0193b6eeec1fd3aa15e840fc83e71225bf | |
parent | a6715af1e72da289474011be1e2d536f991eda34 (diff) |
pgcrypto: Check for error return of px_cipher_decrypt()
This has previously not been a problem (that anyone ever reported),
but in future OpenSSL versions (3.0.0), where legacy ciphers are/can
be disabled, this is the place where this is reported. So we need to
catch the error here, otherwise the higher-level functions would
return garbage. The nearby encryption code already handled errors
similarly.
Reviewed-by: Daniel Gustafsson <[email protected]>
Discussion: https://www.postgresql.org/message-id/[email protected]
-rw-r--r-- | contrib/pgcrypto/px.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/pgcrypto/px.c b/contrib/pgcrypto/px.c index a243f575d3b..4205e9c3eff 100644 --- a/contrib/pgcrypto/px.c +++ b/contrib/pgcrypto/px.c @@ -292,6 +292,7 @@ static int combo_decrypt(PX_Combo *cx, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen) { + int err = 0; unsigned bs, i, pad; @@ -317,7 +318,9 @@ combo_decrypt(PX_Combo *cx, const uint8 *data, unsigned dlen, /* decrypt */ *rlen = dlen; - px_cipher_decrypt(c, data, dlen, res); + err = px_cipher_decrypt(c, data, dlen, res); + if (err) + return err; /* unpad */ if (bs > 1 && cx->padding) |