summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2007-11-14 07:59:22 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2007-11-14 07:59:22 +0200
commit64061d8f726cbb4865186f26d6aa484928d6dbb0 (patch)
tree09d0bce9900ca4001f1169d3b522ca7dd17cfe19
parentf3a6c12fb06c0b7f3e54b210cafae79ca3476c08 (diff)
downloadgnutls-64061d8f726cbb4865186f26d6aa484928d6dbb0.tar.gz
some updates in the compression code
-rw-r--r--lib/gnutls_cipher.c8
-rw-r--r--lib/gnutls_compress.c4
-rw-r--r--lib/gnutls_compress_int.c2
3 files changed, 11 insertions, 3 deletions
diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c
index 0032b1423c..e930c1de3f 100644
--- a/lib/gnutls_cipher.c
+++ b/lib/gnutls_cipher.c
@@ -176,6 +176,14 @@ _gnutls_decrypt (gnutls_session_t session, opaque * ciphertext,
return GNUTLS_E_DECOMPRESSION_FAILED;
}
+ /* This check is not really needed */
+ if (max_data_size < MAX_RECORD_RECV_SIZE)
+ {
+ gnutls_assert();
+ _gnutls_free_datum (&gtxt);
+ return GNUTLS_E_INTERNAL_ERROR;
+ }
+
memcpy (data, gtxt.data, gtxt.size);
ret = gtxt.size;
diff --git a/lib/gnutls_compress.c b/lib/gnutls_compress.c
index 32b263b9ee..843afd7f85 100644
--- a/lib/gnutls_compress.c
+++ b/lib/gnutls_compress.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2004, 2005 Free Software Foundation
+ * Copyright (C) 2000, 2004, 2005, 2007 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*
@@ -44,7 +44,7 @@ _gnutls_m_plaintext2compressed (gnutls_session_t session,
size =
_gnutls_compress (session->connection_state.write_compression_state,
plaintext->data, plaintext->size, &data,
- MAX_RECORD_SEND_SIZE + 1024);
+ MAX_RECORD_SEND_SIZE + EXTRA_COMP_SIZE);
if (size < 0)
{
gnutls_assert ();
diff --git a/lib/gnutls_compress_int.c b/lib/gnutls_compress_int.c
index f3495121d8..092b2e6f9b 100644
--- a/lib/gnutls_compress_int.c
+++ b/lib/gnutls_compress_int.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation
+ * Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*