From 1d36cc4ce1b08dba786a4709f9218b7294c9b552 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 25 Feb 2025 10:55:07 +0900 Subject: [PATCH] Fix whitelist begins-with/ends-with --- src/helpers.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/helpers.c b/src/helpers.c index 46fdc86..9ec87c2 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -759,27 +759,37 @@ uint_fast8_t simple_archiver_helper_string_allowed_lists( } } if (parsed->whitelist_begins) { + uint_fast8_t contains = 0; for (const SDArchiverLLNode *node = parsed->whitelist_begins->head->next; node != parsed->whitelist_begins->tail; node = node->next) { if (node->data) { - if (!simple_archiver_helper_string_starts( + if (simple_archiver_helper_string_starts( cstring, node->data, case_i)) { - return 0; + contains = 1; + break; } } } + if (!contains) { + return 0; + } } if (parsed->whitelist_ends) { + uint_fast8_t contains = 0; for (const SDArchiverLLNode *node = parsed->whitelist_ends->head->next; node != parsed->whitelist_ends->tail; node = node->next) { if (node->data) { - if (!simple_archiver_helper_string_ends(cstring, node->data, case_i)) { - return 0; + if (simple_archiver_helper_string_ends(cstring, node->data, case_i)) { + contains = 1; + break; } } } + if (!contains) { + return 0; + } } if (parsed->blacklist_contains_any) { -- 2.49.0