1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00

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