From e53ba08626e432f9ec14a7002a0d3ffd00b93c5d Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sun, 1 May 2016 13:39:44 +0100 Subject: sway: fix potential buffer overflow --- sway/commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sway/commands.c') 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); -- cgit v1.2.3