File extraction: use fseek

In the past, we allocated a buffer with zeroes and wrote that with
fwrite. Now, instead we just fseek to the correct offset.

This changes the way in which the file extract limit is counted a bit;
skipped bytes do no longer count against the file size limit.

(cherry picked from commit 5071592e9b7105090a1d9de19689c499070749d4)
This commit is contained in:
Johanna Amann 2023-09-06 10:08:27 +01:00 committed by Tim Wojtulewicz
parent 5934e143aa
commit 9928f7efb7
3 changed files with 29 additions and 26 deletions

View file

@ -72,8 +72,8 @@ protected:
private:
std::string filename;
FILE* file_stream;
uint64_t limit;
uint64_t depth;
uint64_t limit; // the file extraction limit
uint64_t written; // how many bytes we have written so far
};
} // namespace zeek::file_analysis::detail