From 0a62c7bd40b42108fe85f325c70e8d1b2ab668a4 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 31 May 2022 09:20:07 +0300 Subject: [PATCH] secur32: Update output buffer offset on return from schan_send() call. Signed-off-by: Nikolay Sivov --- dlls/secur32/schannel.c | 8 +++++++- dlls/secur32/schannel_gnutls.c | 3 ++- dlls/secur32/secur32_priv.h | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index 1f4a1005550..289802c5b32 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -1299,7 +1299,8 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle SIZE_T data_size; SIZE_T length; char *data; - int idx; + int idx, output_buffer_idx = -1; + ULONG output_offset = 0; TRACE("context_handle %p, quality %ld, message %p, message_seq_no %ld\n", context_handle, quality, message, message_seq_no); @@ -1326,8 +1327,13 @@ static SECURITY_STATUS SEC_ENTRY schan_EncryptMessage(PCtxtHandle context_handle params.output = message; params.buffer = data; params.length = &length; + params.output_buffer_idx = &output_buffer_idx; + params.output_offset = &output_offset; status = GNUTLS_CALL( send, ¶ms ); + if (!status && output_buffer_idx != -1) + message->pBuffers[output_buffer_idx].cbBuffer = output_offset; + TRACE("Sent %Id bytes.\n", length); if (length != data_size) diff --git a/dlls/secur32/schannel_gnutls.c b/dlls/secur32/schannel_gnutls.c index 82437207982..ebce6bacde0 100644 --- a/dlls/secur32/schannel_gnutls.c +++ b/dlls/secur32/schannel_gnutls.c @@ -878,7 +878,8 @@ static NTSTATUS schan_send( void *args ) } } - t->out.desc->pBuffers[t->out.current_buffer_idx].cbBuffer = t->out.offset; + *params->output_buffer_idx = t->out.current_buffer_idx; + *params->output_offset = t->out.offset; return SEC_E_OK; } diff --git a/dlls/secur32/secur32_priv.h b/dlls/secur32/secur32_priv.h index 574d3d51cb5..8a494309710 100644 --- a/dlls/secur32/secur32_priv.h +++ b/dlls/secur32/secur32_priv.h @@ -167,6 +167,8 @@ struct send_params SecBufferDesc *output; const void *buffer; SIZE_T *length; + int *output_buffer_idx; + ULONG *output_offset; }; struct set_application_protocols_params