[Combi] Add a check against recursion.

Fixes: #1510
This commit is contained in:
Dave Davenport 2021-10-29 00:39:51 +02:00
parent bde8175d39
commit c45fc38856

View file

@ -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));