From 15221558926e7205ca9af363a8f9c9a82c2f2a09 Mon Sep 17 00:00:00 2001 From: Andras Fekete Date: Fri, 28 Apr 2023 14:08:15 -0400 Subject: [PATCH] Should only move the index by the amount we wrote --- src/internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal.c b/src/internal.c index e7b10cc51..5326905d1 100644 --- a/src/internal.c +++ b/src/internal.c @@ -20908,7 +20908,7 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input, if (args->ivSz > 0) { XMEMCPY(output + args->idx, args->iv, min(args->ivSz, MAX_IV_SZ)); - args->idx += args->ivSz; + args->idx += min(args->ivSz, MAX_IV_SZ); } XMEMCPY(output + args->idx, input, inSz); args->idx += inSz;