mime/base64: fix final data not getting processed

If the last data of the body was not a multple of 4 and not padded
to be a multiple of 4, it would not be processed.
pull/7586/head
Victor Julien 2 years ago
parent 100d821a9f
commit 0d6ab727c5

@ -1226,6 +1226,14 @@ static uint8_t ProcessBase64Remainder(
state->bvr_len = cnt;
}
/* in force mode pad the block */
if (force && cnt != B64_BLOCK) {
SCLogDebug("force and cnt %u != %u", cnt, B64_BLOCK);
for (uint8_t i = state->bvr_len; i < B64_BLOCK; i++) {
state->bvremain[state->bvr_len++] = '=';
}
}
/* If data chunk buffer will be full, then clear it now */
if (DATA_CHUNK_SIZE - state->data_chunk_len < ASCII_BLOCK) {

Loading…
Cancel
Save