From: Andre Noll Date: Sun, 7 Aug 2011 19:19:21 +0000 (+0200) Subject: gcrypt: Check return value of unpad_oaep(). X-Git-Tag: v0.4.8~19 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=28f8e42aa8a086fa25b1d1668945aed415a55b28;hp=e9ac00becb2aba5bbbf51b4803b81b10ed4d6788 gcrypt: Check return value of unpad_oaep(). unpad_oaep() may fail, so we have to check the return value. --- 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);;