aboutsummaryrefslogtreecommitdiff
path: root/sway/commands.c
diff options
context:
space:
mode:
authorEric Engestrom <eric@engestrom.ch>2016-05-01 13:39:44 +0100
committerEric Engestrom <eric@engestrom.ch>2016-05-01 13:57:23 +0100
commite53ba08626e432f9ec14a7002a0d3ffd00b93c5d (patch)
treefd8b8a5b39fac14390595442a87cc3caf7c4afe9 /sway/commands.c
parentaece36cd22aa50015d1eb737b2b31a0b7087e813 (diff)
sway: fix potential buffer overflow
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 79591925..73e9ffaf 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -506,7 +506,8 @@ static struct cmd_results *cmd_exec_always(int argc, char **argv) {
// Put argument into cmd array
char cmd[4096];
- strcpy(cmd, tmp);
+ strncpy(cmd, tmp, sizeof(cmd));
+ cmd[sizeof(cmd) - 1] = 0;
free(tmp);
sway_log(L_DEBUG, "Executing %s", cmd);