]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
file: consistently track size of gaps
authorVictor Julien <vjulien@oisf.net>
Mon, 13 Jun 2022 10:55:52 +0000 (12:55 +0200)
committerVictor Julien <vjulien@oisf.net>
Mon, 13 Jun 2022 14:59:47 +0000 (16:59 +0200)
Until now only the size of gaps counted in the regular append, not
close and open.

Bug: #5392.

src/util-file.c

index 6e1b73087098676a90038b3ce30ac1165b515dca..81913ae21e32d9e31225a49d7ffe34c051e4d757 100644 (file)
@@ -900,8 +900,8 @@ static File *FileOpenFile(FileContainer *ffc, const StreamingBufferConfig *sbcfg
 
     FileContainerAdd(ffc, ff);
 
+    ff->size += data_len;
     if (data != NULL) {
-        ff->size += data_len;
         if (AppendData(ff, data, data_len) != 0) {
             ff->state = FILE_STATE_ERROR;
             SCReturnPtr(NULL, "File");
@@ -942,8 +942,8 @@ int FileCloseFilePtr(File *ff, const uint8_t *data,
         SCReturnInt(-1);
     }
 
+    ff->size += data_len;
     if (data != NULL) {
-        ff->size += data_len;
         if (ff->flags & FILE_NOSTORE) {
             /* no storage but hashing */
             if (ff->md5_ctx)