From 28f8e42aa8a086fa25b1d1668945aed415a55b28 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 7 Aug 2011 21:19:21 +0200 Subject: [PATCH] gcrypt: Check return value of unpad_oaep(). unpad_oaep() may fail, so we have to check the return value. --- gcrypt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcrypt.c b/gcrypt.c index c6365470..f825f6c6 100644 --- a/gcrypt.c +++ b/gcrypt.c @@ -763,7 +763,9 @@ static int decode_rsa(gcry_sexp_t sexp, int key_size, unsigned char *outbuf, PARA_DEBUG_LOG("decrypted buffer before unpad (%d bytes):\n", key_size); dump_buffer("non-unpadded decrypted buffer", oaep_buf, key_size);; - unpad_oaep(oaep_buf, key_size, outbuf, nbytes); + ret = unpad_oaep(oaep_buf, key_size, outbuf, nbytes); + if (ret < 0) + goto out_mpi_release; PARA_DEBUG_LOG("decrypted buffer after unpad (%zu bytes):\n", *nbytes); dump_buffer("unpadded decrypted buffer", outbuf, *nbytes);; -- 2.39.2