]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
mime: process chunk as soon as possible 9513/head
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 4 Sep 2023 13:51:16 +0000 (15:51 +0200)
committerPhilippe Antoine <pantoine@oisf.net>
Fri, 22 Sep 2023 11:05:38 +0000 (13:05 +0200)
In the case stream depth gets reached afterwards, it cannot be
processed after that.

Ticket: #6367

src/util-decode-mime.c

index b22a8c2e6f619d20c02ffa966afdf265f83e8da0..8e8b426c44a86f44478211f64246d86fa5273ee2 100644 (file)
@@ -1375,17 +1375,22 @@ static int ProcessBase64BodyLine(const uint8_t *buf, uint32_t len,
          * size. We strip of spaces this while storing it in bvremain */
         if (consumed_bytes == 0 && leftover_bytes > B64_BLOCK) {
             DEBUG_VALIDATE_BUG_ON(state->bvr_len != 0);
-            return ProcessBase64BodyLineCopyRemainder(buf, len, offset, state);
+            ret = ProcessBase64BodyLineCopyRemainder(buf, len, offset, state);
+            break;
         } else if (leftover_bytes > 0 && leftover_bytes <= B64_BLOCK) {
             /* If remaining is 4 by this time, we encountered spaces during processing */
             DEBUG_VALIDATE_BUG_ON(state->bvr_len != 0);
-            return ProcessBase64BodyLineCopyRemainder(buf, len, offset + consumed_bytes, state);
+            ret = ProcessBase64BodyLineCopyRemainder(buf, len, offset + consumed_bytes, state);
+            break;
         }
 
         /* Update counts */
         remaining = leftover_bytes;
         offset += consumed_bytes;
     }
+    if (ret == MIME_DEC_OK && state->data_chunk_len > 0) {
+        ret = ProcessDecodedDataChunk(state->data_chunk, state->data_chunk_len, state);
+    }
     return ret;
 }