http://git.savannah.gnu.org/gitweb/?p=gnutls.git;a=commit;h=422214868061370aeeb0ac9cd0f021a5c350a57d --- lib/gnutls_cipher.c 2009-11-02 10:30:39.000000000 +0000 +++ lib/gnutls_cipher.c.oden 2012-03-27 08:24:14.000000000 +0000 @@ -501,14 +501,13 @@ _gnutls_ciphertext2compressed (gnutls_se { 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)