From ccb1c711ba6d0f14f3e300e3f7db98bc9d9faa5e Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 17 Feb 2025 15:29:18 +0900 Subject: [PATCH] WIP white/black-list: Fix b-contains behavior Up to this commit, --blacklist-contains would blacklist any entry that matches any . This behavior has been changed to only blacklist any entry that contains all entries specified by multiple --blacklist-contains (or just 1 if there was only 1 flag). TODO: - white/black-lists for test/extract for file format version 1 and 2. - white/black-lists for create/test/extract for file format version 0. --- src/helpers.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/helpers.c b/src/helpers.c index 8150e2c..7f5ac95 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -765,16 +765,22 @@ uint_fast8_t simple_archiver_helper_string_allowed_lists( } if (b_contains) { + uint_fast8_t contains_all = 1; for (const SDArchiverLLNode *node = b_contains->head->next; node != b_contains->tail; node = node->next) { if (node->data) { - if (simple_archiver_helper_string_contains( + if (!simple_archiver_helper_string_contains( cstring, node->data, case_i)) { - return 0; + contains_all = 0; + break; } } } + + if (contains_all) { + return 0; + } } if (b_begins) { for (const SDArchiverLLNode *node = b_begins->head->next; -- 2.49.0