diff options
author | Eric Engestrom <eric@engestrom.ch> | 2016-05-01 13:39:44 +0100 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2016-05-01 13:57:23 +0100 |
commit | e53ba08626e432f9ec14a7002a0d3ffd00b93c5d (patch) | |
tree | fd8b8a5b39fac14390595442a87cc3caf7c4afe9 /sway | |
parent | common: fix potential buffer overflow (diff) | |
download | sway-e53ba08626e432f9ec14a7002a0d3ffd00b93c5d.tar.gz sway-e53ba08626e432f9ec14a7002a0d3ffd00b93c5d.tar.zst sway-e53ba08626e432f9ec14a7002a0d3ffd00b93c5d.zip |
sway: fix potential buffer overflow
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 3 |
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) { | |||
506 | 506 | ||
507 | // Put argument into cmd array | 507 | // Put argument into cmd array |
508 | char cmd[4096]; | 508 | char cmd[4096]; |
509 | strcpy(cmd, tmp); | 509 | strncpy(cmd, tmp, sizeof(cmd)); |
510 | cmd[sizeof(cmd) - 1] = 0; | ||
510 | free(tmp); | 511 | free(tmp); |
511 | sway_log(L_DEBUG, "Executing %s", cmd); | 512 | sway_log(L_DEBUG, "Executing %s", cmd); |
512 | 513 | ||