diff options
author | Ian Fan <[email protected]> | 2018-08-12 00:32:13 +0100 |
---|---|---|
committer | Ian Fan <[email protected]> | 2018-08-18 17:25:06 +0100 |
commit | e81cc8a5754386d9484b84cf97ab2f8755c35294 (patch) | |
tree | a3a9f64d0e179b07f94e2fff1484f5099f440432 /sway/commands/move.c | |
parent | 69e00151bbd5c2648194b538ad80aba1d305d24a (diff) |
commands: saner workspace number handling
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r-- | sway/commands/move.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index f5eb9124..33d1ee4a 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -1,4 +1,5 @@ #define _XOPEN_SOURCE 500 +#include <ctype.h> #include <stdbool.h> #include <string.h> #include <strings.h> @@ -124,7 +125,11 @@ static struct cmd_results *cmd_move_container(struct sway_container *current, return cmd_results_new(CMD_INVALID, "move", expected_syntax); } - ws_name = strdup(argv[3]); + if (!isdigit(argv[3][0])) { + return cmd_results_new(CMD_INVALID, "move", + "Invalid workspace number '%s'", argv[3]); + } + ws_name = join_args(argv + 3, argc - 3); ws = workspace_by_number(ws_name); } else { ws_name = join_args(argv + 2, argc - 2); |