From fd216b3a81129f15036755bc6f383c7c261291a5 Mon Sep 17 00:00:00 2001 From: Konstantin Pospelov Date: Sun, 23 Aug 2020 13:59:22 +0200 Subject: exec: fix validation during config reload Split cmd_exec_always into separate methods for general validation and process creation. This fixes a potential call of join_args with 0 arguments. --- sway/commands/exec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sway/commands/exec.c') diff --git a/sway/commands/exec.c b/sway/commands/exec.c index 87d90716..2c6f3d2d 100644 --- a/sway/commands/exec.c +++ b/sway/commands/exec.c @@ -5,12 +5,15 @@ #include "stringop.h" struct cmd_results *cmd_exec(int argc, char **argv) { - if (!config->active) return cmd_results_new(CMD_DEFER, NULL); + struct cmd_results *error = NULL; + if ((error = cmd_exec_validate(argc, argv))) { + return error; + } if (config->reloading) { char *args = join_args(argv, argc); sway_log(SWAY_DEBUG, "Ignoring 'exec %s' due to reload", args); free(args); return cmd_results_new(CMD_SUCCESS, NULL); } - return cmd_exec_always(argc, argv); + return cmd_exec_process(argc, argv); } -- cgit v1.2.3