summaryrefslogtreecommitdiff
path: root/lib/gnutls_buffers.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-11-22 22:28:38 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-11-22 22:32:43 +0100
commit172ae00887559fa5ba9a3bdc41d9eccb4844b077 (patch)
tree80ce59a46a2c06f9e5fce5db5f44229cb10de465 /lib/gnutls_buffers.c
parent9e8f30bc0d2f2a8a20ef3bd93af1220e0b176a57 (diff)
downloadgnutls-172ae00887559fa5ba9a3bdc41d9eccb4844b077.tar.gz
Corrected bug which affected compressed records.
Less space was provided for decryption than the required causing disconnection issues when compression was used. The issue was pointed by Frank Zschockelt. Also replaced the macros MAX_RECORD_RECV_SIZE and MAX_RECV_SIZE with max_decrypted_size() and max_record_recv_size().
Diffstat (limited to 'lib/gnutls_buffers.c')
-rw-r--r--lib/gnutls_buffers.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c
index 4ea0cc94b6..7f3b5a4147 100644
--- a/lib/gnutls_buffers.c
+++ b/lib/gnutls_buffers.c
@@ -185,8 +185,8 @@ _gnutls_dgram_read(gnutls_session_t session, mbuffer_st ** bufel,
ssize_t i, ret;
uint8_t *ptr;
struct timespec t1, t2;
- size_t max_size = get_max_decrypted_data(session);
- size_t recv_size = MAX_RECV_SIZE(session);
+ size_t max_size = max_record_recv_size(session);
+ size_t recv_size = max_record_recv_size(session);
gnutls_transport_ptr_t fd = session->internals.transport_recv_ptr;
unsigned int diff;
@@ -261,7 +261,7 @@ _gnutls_stream_read(gnutls_session_t session, mbuffer_st ** bufel,
{
size_t left;
ssize_t i = 0;
- size_t max_size = get_max_decrypted_data(session);
+ size_t max_size = max_record_recv_size(session);
uint8_t *ptr;
gnutls_transport_ptr_t fd = session->internals.transport_recv_ptr;
int ret;
@@ -436,7 +436,7 @@ _gnutls_writev(gnutls_session_t session, const giovec_t * giovec,
* This function is like recv(with MSG_PEEK). But it does not return -1 on error.
* It does return gnutls_errno instead.
* This function reads data from the socket and keeps them in a buffer, of up to
- * MAX_RECV_SIZE.
+ * max_record_recv_size.
*
* This is not a general purpose function. It returns EXACTLY the data requested,
* which are stored in a local (in the session) buffer.
@@ -454,7 +454,7 @@ _gnutls_io_read_buffered(gnutls_session_t session, size_t total,
mbuffer_st *bufel = NULL;
size_t recvdata, readsize;
- if (total > MAX_RECV_SIZE(session) || total == 0) {
+ if (total > max_record_recv_size(session) || total == 0) {
gnutls_assert(); /* internal error */
return GNUTLS_E_INVALID_REQUEST;
}
@@ -483,7 +483,7 @@ _gnutls_io_read_buffered(gnutls_session_t session, size_t total,
* receive are longer than the maximum receive buffer size.
*/
if ((session->internals.record_recv_buffer.byte_length +
- recvdata) > MAX_RECV_SIZE(session)) {
+ recvdata) > max_record_recv_size(session)) {
gnutls_assert(); /* internal error */
return GNUTLS_E_INVALID_REQUEST;
}