]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
mime: remove unused length fields 7586/head
authorVictor Julien <vjulien@oisf.net>
Wed, 29 Jun 2022 09:16:43 +0000 (11:16 +0200)
committerVictor Julien <vjulien@oisf.net>
Wed, 29 Jun 2022 09:16:49 +0000 (11:16 +0200)
src/util-decode-mime.c
src/util-decode-mime.h

index 2be9852c04c96447f51909e1e96e05f48bea84ed..c928c661345070af04aede3b69cab7efe99094a6 100644 (file)
@@ -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 &&
index 3fd15899b40288d0f1ff6092edb971d727cebf5e..d6aeb154723678a71d5cdd0a003f10ef5ddfd4dc 100644 (file)
@@ -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 */