From: Victor Julien Date: Mon, 13 Jun 2022 10:55:52 +0000 (+0200) Subject: file: consistently track size of gaps X-Git-Tag: suricata-5.0.10~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85cad60b55cbe3a54cd11b93e894babf362b7de4;p=thirdparty%2Fsuricata.git file: consistently track size of gaps Until now only the size of gaps counted in the regular append, not close and open. Bug: #5392. (cherry picked from commit 71ef62bfc5ee8ffe4798467935f4f9386178565e) --- diff --git a/src/util-file.c b/src/util-file.c index f148dff88a..17a0181336 100644 --- a/src/util-file.c +++ b/src/util-file.c @@ -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 */