]> 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>
Tue, 14 Jun 2022 08:11:17 +0000 (10:11 +0200)
Until now only the size of gaps counted in the regular append, not
close and open.

Bug: #5392.
(cherry picked from commit 71ef62bfc5ee8ffe4798467935f4f9386178565e)

src/util-file.c

index f148dff88a3e18d436c0404e512a2dab4efad811..17a0181336016330a375d487a80716ba1065326d 100644 (file)
@@ -888,8 +888,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");
@@ -928,8 +928,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) {
 #ifdef HAVE_NSS
             /* no storage but hashing */