int body_found = 0;
uint16_t tlen;
- if (!g_disable_hashing) {
- if (MimeDecGetConfig()->body_md5) {
- if (state->body_begin == 1) {
- if (state->md5_ctx == NULL) {
- state->md5_ctx = SCMd5New();
- }
- }
- SCMd5Update(state->md5_ctx, buf, len + state->current_line_delimiter_len);
- }
- }
-
/* pass empty lines on if we're parsing the body, otherwise we have no use
* for them, and in fact they would disrupt the state tracking */
if (len == 0) {
MAX_LINE_LEN);
}
+ if (!g_disable_hashing) {
+ if ((state->state_flag != HEADER_READY && state->state_flag != HEADER_STARTED) ||
+ (state->stack->top->data->ctnt_flags & CTNT_IS_BODYPART)) {
+ if (MimeDecGetConfig()->body_md5) {
+ if (state->body_begin == 1 && state->md5_ctx == NULL) {
+ state->md5_ctx = SCMd5New();
+ }
+ SCMd5Update(state->md5_ctx, buf, len + state->current_line_delimiter_len);
+ }
+ }
+ }
+
/* Looking for headers */
if (state->state_flag == HEADER_READY ||
state->state_flag == HEADER_STARTED) {