Skip to content

Commit

Permalink
file: consistently track size of gaps
Browse files Browse the repository at this point in the history
Until now only the size of gaps counted in the regular append, not
close and open.

Bug: OISF#5392.
(cherry picked from commit 71ef62b)
  • Loading branch information
victorjulien committed Jun 13, 2022
1 parent aeee505 commit e9b88f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,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");
Expand Down Expand Up @@ -955,8 +955,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 */
Expand Down

0 comments on commit e9b88f6

Please sign in to comment.