From: Aki Tuomi Date: Mon, 28 Nov 2016 13:20:01 +0000 (+0200) Subject: lib-dcrypt: Add error handling for dcrypt_key_id_private X-Git-Tag: 2.2.27~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=beb9cf38b3fccef8e4318769760ce43e4b4c400b;p=thirdparty%2Fdovecot%2Fcore.git lib-dcrypt: Add error handling for dcrypt_key_id_private --- diff --git a/src/lib-dcrypt/istream-decrypt.c b/src/lib-dcrypt/istream-decrypt.c index 9da17e8a68..a8aea314db 100644 --- a/src/lib-dcrypt/istream-decrypt.c +++ b/src/lib-dcrypt/istream-decrypt.c @@ -291,7 +291,13 @@ ssize_t i_stream_decrypt_key(struct decrypt_istream *stream, const char *malg, u return -1; } buffer_create_from_data(&buf, dgst, sizeof(dgst)); - dcrypt_key_id_private(stream->priv_key, "sha256", &buf, NULL); + if (!dcrypt_key_id_private(stream->priv_key, "sha256", &buf, + &error)) { + io_stream_set_error(&stream->istream.iostream, "Decryption error: " + "dcrypt_key_id_private failed: %s", + error); + return -1; + } } /* for each key */