blob: 09cc9a448120aa8b42549c48eb9a3cb85eb9f21c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
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)
|