]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smtp/files: don't modify prev file on open failure
authorVictor Julien <vjulien@oisf.net>
Wed, 23 Nov 2022 13:42:21 +0000 (14:42 +0100)
committerVictor Julien <vjulien@oisf.net>
Sat, 26 Nov 2022 06:07:15 +0000 (07:07 +0100)
(cherry picked from commit 9f4dd4fc56a8885bdff0714352dffa5b897f5979)

src/app-layer-smtp.c

index b20659c19827fd866735fa9052aded11f6e9bf0a..414a2c7d30c95da9940107beaf82a6d222d67d7b 100644 (file)
@@ -446,8 +446,9 @@ int SMTPProcessDataChunk(const uint8_t *chunk, uint32_t len,
                         (uint8_t *) chunk, len, flags) != 0) {
                 ret = MIME_DEC_ERR_DATA;
                 SCLogDebug("FileOpenFile() failed");
+            } else {
+                SMTPNewFile(smtp_state->curr_tx, files->tail);
             }
-            SMTPNewFile(smtp_state->curr_tx, files->tail);
 
             /* If close in the same chunk, then pass in empty bytes */
             if (state->body_end) {