diff --git a/src/util-decode-mime.c b/src/util-decode-mime.c index e13216118a..7ee5263b76 100644 --- a/src/util-decode-mime.c +++ b/src/util-decode-mime.c @@ -1197,8 +1197,9 @@ static uint32_t ProcessBase64Remainder( } buf_consumed++; } - if (cnt != 0) { - memcpy(state->bvremain, block, cnt); + DEBUG_VALIDATE_BUG_ON(cnt > B64_BLOCK); + for (uint32_t i = 0; i < cnt; i++) { + state->bvremain[i] = block[i]; } state->bvr_len = cnt; } else if (!force && cnt != B64_BLOCK) {