mirror of
https://github.com/swaywm/sway.git
synced 2026-03-02 01:40:50 -05:00
Fix segfaults caused by faulty command parsing
This patch fixes faulty command parsing introduced by
f0f5de9a9e. When that commit allowed
criteria reset on ';' delimeters in commands lists, it failed to account
for its inner ','-parsing loop eating threw the entire rest of the
string.
This patch refactors argsep to use a list of multiple separators, and
(optionally) return the separator that it matched against in this
iteration via a pointer. This allows it to hint at the command parser
which separator was used at the end of the last command, allowing it to
trigger a potential secondary read of the criteria.
Fixes #4239
This commit is contained in:
parent
3f77591b00
commit
2b5bf78faf
4 changed files with 106 additions and 85 deletions
|
|
@ -212,9 +212,9 @@ static void workspace_name_from_binding(const struct sway_binding * binding,
|
|||
char *name = NULL;
|
||||
|
||||
// workspace n
|
||||
char *cmd = argsep(&cmdlist, " ");
|
||||
char *cmd = argsep(&cmdlist, " ", NULL);
|
||||
if (cmdlist) {
|
||||
name = argsep(&cmdlist, ",;");
|
||||
name = argsep(&cmdlist, ",;", NULL);
|
||||
}
|
||||
|
||||
// TODO: support "move container to workspace" bindings as well
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue