aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sway/commands.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sway/commands.c b/sway/commands.c
index fc3444ee..9f6e5032 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -177,10 +177,10 @@ static struct cmd_results *cmd_assign(int argc, char **argv) {
}
char *movecmd = "move container to workspace ";
- int arglen = strlen(*argv);
- char *cmdlist = calloc(1, sizeof(movecmd) + arglen);
+ int arglen = strlen(movecmd) + strlen(*argv) + 1;
+ char *cmdlist = calloc(1, arglen);
- sprintf(cmdlist, "%s%s", movecmd, *argv);
+ snprintf(cmdlist, arglen, "%s%s", movecmd, *argv);
struct criteria *crit = malloc(sizeof(struct criteria));
crit->crit_raw = strdup(criteria);