]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
files: append data on closing even with FILE_NOSTORE
authorPhilippe Antoine <pantoine@oisf.net>
Tue, 4 Mar 2025 15:30:19 +0000 (16:30 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 5 Mar 2025 14:59:55 +0000 (15:59 +0100)
Ticket: 7577

When HTTP1 post multipart handles a small file, it will call
HTPFileClose with some data
This data needs to be appended to the streaming buffer for usage
by file.data keyword even if we do not end up storing the file

src/util-file.c

index fdb8d740d8cbebc131e6c56c9cd50b1b519eb977..e9faf3f04df8c00c27eed966999311a15c10d3ad 100644 (file)
@@ -1019,11 +1019,10 @@ int FileCloseFilePtr(File *ff, const StreamingBufferConfig *sbcfg, const uint8_t
                 SCLogDebug("file %p data %p data_len %u", ff, data, data_len);
                 SCSha256Update(ff->sha256_ctx, data, data_len);
             }
-        } else {
-            if (AppendData(sbcfg, ff, data, data_len) != 0) {
-                ff->state = FILE_STATE_ERROR;
-                SCReturnInt(-1);
-            }
+        }
+        if (AppendData(sbcfg, ff, data, data_len) != 0) {
+            ff->state = FILE_STATE_ERROR;
+            SCReturnInt(-1);
         }
     }