better check decrypted data. Based on: http://git.savannah.gnu.org/gitweb/?p=gnutls.git;a=commitdiff_plain;h=422214868061370aeeb0ac9cd0f021a5c350a57d --- diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c index 22d02f6..6b83208 100644 --- a/lib/gnutls_cipher.c +++ b/lib/gnutls_cipher.c @@ -511,14 +511,13 @@ _gnutls_ciphertext2compressed (gnutls_session_t session, { ciphertext.size -= blocksize; ciphertext.data += blocksize; - - if (ciphertext.size == 0) - { - gnutls_assert (); - return GNUTLS_E_DECRYPTION_FAILED; - } } + if (ciphertext.size < hash_size) + { + gnutls_assert (); + return GNUTLS_E_DECRYPTION_FAILED; + } pad = ciphertext.data[ciphertext.size - 1] + 1; /* pad */ if ((int) pad > (int) ciphertext.size - hash_size)