From: Victor Julien Date: Wed, 29 Jun 2022 09:16:43 +0000 (+0200) Subject: mime: remove unused length fields X-Git-Tag: suricata-7.0.0-beta1~412 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7586%2Fhead;p=thirdparty%2Fsuricata.git mime: remove unused length fields --- diff --git a/src/util-decode-mime.c b/src/util-decode-mime.c index 2be9852c04..c928c66134 100644 --- a/src/util-decode-mime.c +++ b/src/util-decode-mime.c @@ -1261,11 +1261,8 @@ static uint8_t ProcessBase64Remainder( PrintChars(SC_LOG_DEBUG, "BASE64 DECODED (bvremain)", state->data_chunk + state->data_chunk_len, remdec); - /* Track decoded length */ - state->stack->top->data->decoded_body_len += remdec; - - /* Update length */ state->data_chunk_len += remdec; + /* If data chunk buffer is now full, then clear */ if (DATA_CHUNK_SIZE - state->data_chunk_len < ASCII_BLOCK) { @@ -1363,9 +1360,6 @@ static int ProcessBase64BodyLine(const uint8_t *buf, uint32_t len, PrintChars(SC_LOG_DEBUG, "BASE64 DECODED (line)", state->data_chunk + state->data_chunk_len, numDecoded); - /* Track decoded length */ - state->stack->top->data->decoded_body_len += numDecoded; - /* Update length */ state->data_chunk_len += numDecoded; if ((int)(DATA_CHUNK_SIZE - state->data_chunk_len) < 0) { @@ -1483,13 +1477,11 @@ static int ProcessQuotedPrintableBodyLine(const uint8_t *buf, uint32_t len, if (c != '=') { state->data_chunk[state->data_chunk_len] = c; state->data_chunk_len++; - entity->decoded_body_len += 1; /* Add CRLF sequence if end of line, unless its a partial line */ if (remaining == 1 && state->current_line_delimiter_len > 0) { memcpy(state->data_chunk + state->data_chunk_len, CRLF, EOL_LEN); state->data_chunk_len += EOL_LEN; - entity->decoded_body_len += EOL_LEN; } } else if (remaining > 1) { /* If last character handle as soft line break by ignoring, @@ -1521,14 +1513,12 @@ static int ProcessQuotedPrintableBodyLine(const uint8_t *buf, uint32_t len, state->data_chunk[state->data_chunk_len] = val; state->data_chunk_len++; - entity->decoded_body_len++; /* Add CRLF sequence if end of line, unless for partial lines */ if (remaining == 3 && state->current_line_delimiter_len > 0) { memcpy(state->data_chunk + state->data_chunk_len, CRLF, EOL_LEN); state->data_chunk_len += EOL_LEN; - entity->decoded_body_len += EOL_LEN; } /* Account for extra 2 characters in 3-characted QP @@ -1579,9 +1569,6 @@ static int ProcessBodyLine(const uint8_t *buf, uint32_t len, SCLogDebug("Processing body line"); - /* Track length */ - entity->body_len += (len + state->current_line_delimiter_len); - /* Process base-64 content if enabled */ MimeDecConfig *mdcfg = MimeDecGetConfig(); if (mdcfg != NULL && mdcfg->decode_base64 && diff --git a/src/util-decode-mime.h b/src/util-decode-mime.h index 3fd15899b4..d6aeb15472 100644 --- a/src/util-decode-mime.h +++ b/src/util-decode-mime.h @@ -137,8 +137,6 @@ typedef struct MimeDecUrl { typedef struct MimeDecEntity { MimeDecField *field_list; /**< Pointer to list of header fields */ MimeDecUrl *url_list; /**< Pointer to list of URLs */ - uint32_t body_len; /**< Length of body (prior to any decoding) */ - uint32_t decoded_body_len; /**< Length of body after decoding */ uint32_t header_flags; /**< Flags indicating header characteristics */ uint32_t ctnt_flags; /**< Flags indicating type of content */ uint32_t anomaly_flags; /**< Flags indicating an anomaly in the message */