From 78ba5acd70d8818b69c16235103f223576fed9fe Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 8 Oct 2024 15:31:40 +0900 Subject: [PATCH] Add validation of files/symlinks count from files --- src/archiver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/archiver.c b/src/archiver.c index b3634ab..52db646 100644 --- a/src/archiver.c +++ b/src/archiver.c @@ -1861,6 +1861,13 @@ int simple_archiver_write_v1(FILE *out_f, SDArchiverState *state, simple_archiver_priority_heap_free(&files_pheap); } + if (symlinks_list->count + files_list->count != filenames->count) { + fprintf(stderr, + "ERROR: Count mismatch between files and symlinks and files from " + "parser!\n"); + return SDAS_INTERNAL_ERROR; + } + if (fwrite("SIMPLE_ARCHIVE_VER", 1, 18, out_f) != 18) { return SDAS_FAILED_TO_WRITE; }