]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
mime: fix corner case
authorVictor Julien <vjulien@oisf.net>
Tue, 28 Jun 2022 13:29:25 +0000 (15:29 +0200)
committerVictor Julien <vjulien@oisf.net>
Wed, 29 Jun 2022 20:58:48 +0000 (22:58 +0200)
Fix a corner case where a base64 sequence including a space was followed
by a newline in the input data.

(cherry picked from commit d81582c4a2b5b9cd6000c8637a7c6bc9b8f4dfd6)

src/util-decode-mime.c

index 66b22bb87cba4caca4dc65e41b010e5309545d8a..457e3e9da001f0593028a38c836b4860922c5b16 100644 (file)
@@ -1236,6 +1236,9 @@ static uint8_t ProcessBase64Remainder(
             memcpy(state->bvremain, block, cnt);
         }
         state->bvr_len = cnt;
+    } else if (!force && cnt != B64_BLOCK) {
+        SCLogDebug("incomplete data and no buffer to backfill");
+        return 0;
     }
 
     /* in force mode pad the block */