On Mon, 2010-08-30 at 19:37 +0300, Mikko Rasa wrote:
- memcpy(buffer->pvBuffer, data, received);
- buffer->cbBuffer = received;
- buf_ptr = (char *)buffer->pvBuffer;
You don't need this cast.
offset = ctx->header_bytes;
memcpy(buf_ptr + offset, data, received); HeapFree(GetProcessHeap(), 0, data);
schan_decrypt_fill_buffer(message, SECBUFFER_DATA, buf_ptr + offset, received);
offset += received;
schan_decrypt_fill_buffer(message, SECBUFFER_STREAM_TRAILER, buf_ptr + offset, buffer->cbBuffer - offset);
offset += ctx->trailer_bytes;
if(buffer->cbBuffer > offset)
schan_decrypt_fill_buffer(message, SECBUFFER_EXTRA, buf_ptr + offset, buffer->cbBuffer - offset);
buffer->BufferType = SECBUFFER_STREAM_HEADER;
buffer->cbBuffer = ctx->header_bytes;
FWIW, this patch set passes my tests.