Change variable bytes_written to header_bytes in record decompression

The name is changed to better reflect the input, decompression case
This commit is contained in:
Andrzej Kurek 2018-04-24 06:32:44 -04:00
parent bb6661479f
commit 078014aebe

View File

@ -2134,7 +2134,7 @@ static int ssl_decompress_buf( mbedtls_ssl_context *ssl )
{ {
int ret; int ret;
unsigned char *msg_post = ssl->in_msg; unsigned char *msg_post = ssl->in_msg;
ptrdiff_t bytes_written = ssl->in_msg - ssl->in_buf; ptrdiff_t header_bytes = ssl->in_msg - ssl->in_buf;
size_t len_pre = ssl->in_msglen; size_t len_pre = ssl->in_msglen;
unsigned char *msg_pre = ssl->compress_buf; unsigned char *msg_pre = ssl->compress_buf;
@ -2155,7 +2155,7 @@ static int ssl_decompress_buf( mbedtls_ssl_context *ssl )
ssl->transform_in->ctx_inflate.avail_in = len_pre; ssl->transform_in->ctx_inflate.avail_in = len_pre;
ssl->transform_in->ctx_inflate.next_out = msg_post; ssl->transform_in->ctx_inflate.next_out = msg_post;
ssl->transform_in->ctx_inflate.avail_out = MBEDTLS_SSL_BUFFER_LEN - ssl->transform_in->ctx_inflate.avail_out = MBEDTLS_SSL_BUFFER_LEN -
bytes_written; header_bytes;
ret = inflate( &ssl->transform_in->ctx_inflate, Z_SYNC_FLUSH ); ret = inflate( &ssl->transform_in->ctx_inflate, Z_SYNC_FLUSH );
if( ret != Z_OK ) if( ret != Z_OK )
@ -2165,7 +2165,7 @@ static int ssl_decompress_buf( mbedtls_ssl_context *ssl )
} }
ssl->in_msglen = MBEDTLS_SSL_BUFFER_LEN - ssl->in_msglen = MBEDTLS_SSL_BUFFER_LEN -
ssl->transform_in->ctx_inflate.avail_out - bytes_written; ssl->transform_in->ctx_inflate.avail_out - header_bytes;
MBEDTLS_SSL_DEBUG_MSG( 3, ( "after decompression: msglen = %d, ", MBEDTLS_SSL_DEBUG_MSG( 3, ( "after decompression: msglen = %d, ",
ssl->in_msglen ) ); ssl->in_msglen ) );