mirror of
https://github.com/swaywm/sway.git
synced 2026-04-26 06:46:26 -04:00
check for workspace command name arg (fix #5131)
For the 'workspace <name> output <output>' command, output_location must be greater than zero or the attempt to get the workspace name with join_args will segfault or abort() (depending on the flavor of sway_assert() in use). This checks and returns an error instead.
This commit is contained in:
parent
0b9feb6f39
commit
239e658f6b
1 changed files with 4 additions and 1 deletions
|
|
@ -140,7 +140,10 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (output_location >= 0) {
|
||||
if (output_location == 0) {
|
||||
return cmd_results_new(CMD_INVALID, "Expected 'workspace "
|
||||
"<name> output <output>'");
|
||||
} else if (output_location > 0) {
|
||||
if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST,
|
||||
output_location + 2))) {
|
||||
return error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue