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

Commit a8b4b84

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 0816fad commit a8b4b84

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
@@ -341,8 +341,8 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
341341
err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
342342
(uint8 *) VARDATA(iv), ivlen);
343343
if (!err)
344-
px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
345-
(uint8 *) VARDATA(res), &rlen);
344+
err = px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
345+
(uint8 *) VARDATA(res), &rlen);
346346

347347
px_combo_free(c);
348348

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

401401
px_combo_free(c);
402402

0 commit comments

Comments
 (0)