From c45fc388565bc082c16f0ca7dd6998c48506723b Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Fri, 29 Oct 2021 00:39:51 +0200 Subject: [PATCH] [Combi] Add a check against recursion. Fixes: #1510 --- source/dialogs/combi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c index ee4c0421..354a23f6 100644 --- a/source/dialogs/combi.c +++ b/source/dialogs/combi.c @@ -67,6 +67,11 @@ static void combi_mode_parse_switchers(Mode *sw) { // Split token on ','. This modifies switcher_str. for (char *token = strtok_r(switcher_str, sep, &savept); token != NULL; token = strtok_r(NULL, sep, &savept)) { + /* Check against recursion. */ + if ( g_strcmp0(token, sw->name) == 0 ){ + g_warning("You cannot add '%s' to the list of combined modi.", sw->name); + continue; + } // Resize and add entry. pd->switchers = (CombiMode *)g_realloc( pd->switchers, sizeof(CombiMode) * (pd->num_switchers + 1));