From: Michael Tremer Date: Sat, 11 Jan 2025 14:35:14 +0000 (+0000) Subject: parser: Stop expanding variables if the string becomes empty X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91ced353a0c182b05e02bad817a52e8d8f0f0ae5;p=people%2Fric9%2Fpakfire.git parser: Stop expanding variables if the string becomes empty Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/parser.c b/src/pakfire/parser.c index 0614cd73e..0433e63d4 100644 --- a/src/pakfire/parser.c +++ b/src/pakfire/parser.c @@ -511,7 +511,7 @@ static int pakfire_parser_expand_commands(struct pakfire_parser* parser, char** "/bin/sh", "-c", NULL /* will be replaced by command later */, NULL, }; - for (;;) { + while (buffer && *buffer) { // Perform matching r = pcre2_jit_match(regexes.command, (PCRE2_UCHAR*)*buffer, strlen(*buffer), 0, 0, match, NULL); @@ -621,7 +621,7 @@ static int pakfire_parser_expand_variables(struct pakfire_parser* parser, match = pcre2_match_data_create_from_pattern(regexes.variable, NULL); // Search for any variables - for (;;) { + while (buffer && *buffer) { // Perform matching r = pcre2_jit_match(regexes.variable, (PCRE2_UCHAR*)*buffer, strlen(*buffer), 0, 0, match, NULL);