From: Stephen Seo Date: Tue, 25 Feb 2025 01:55:07 +0000 (+0900) Subject: Fix whitelist begins-with/ends-with X-Git-Tag: 1.17~1 X-Git-Url: https://git.seodisparate.com/stephenseo/LD52?a=commitdiff_plain;h=1d36cc4ce1b08dba786a4709f9218b7294c9b552;p=SimpleArchiver Fix whitelist begins-with/ends-with --- 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) {