Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7c016e3

Browse files
committed
Fix error detection in contrib/pgcrypto's encrypt_iv() and decrypt_iv().
Due to oversights, the encrypt_iv() and decrypt_iv() functions failed to report certain types of invalid-input errors, and would instead return random garbage values. Marko Kreen, per report from Stefan Kaltenbrunner
1 parent b7922a6 commit 7c016e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

contrib/pgcrypto/pgcrypto.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
342342
err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
343343
(uint8 *) VARDATA(iv), ivlen);
344344
if (!err)
345-
px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
346-
(uint8 *) VARDATA(res), &rlen);
345+
err = px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
346+
(uint8 *) VARDATA(res), &rlen);
347347

348348
px_combo_free(c);
349349

@@ -396,8 +396,8 @@ pg_decrypt_iv(PG_FUNCTION_ARGS)
396396
err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
397397
(uint8 *) VARDATA(iv), ivlen);
398398
if (!err)
399-
px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen,
400-
(uint8 *) VARDATA(res), &rlen);
399+
err = px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen,
400+
(uint8 *) VARDATA(res), &rlen);
401401

402402
px_combo_free(c);
403403

0 commit comments

Comments
 (0)