diff options
author | 2016-05-01 09:04:12 -0400 | |
---|---|---|
committer | 2016-05-01 09:04:12 -0400 | |
commit | 4915f9761840f05c5a80e92e0efd5318982663b6 (patch) | |
tree | fd8b8a5b39fac14390595442a87cc3caf7c4afe9 /common/ipc-client.c | |
parent | Merge pull request #624 from tajjada/add-input-accel-profile (diff) | |
parent | sway: fix potential buffer overflow (diff) | |
download | sway-4915f9761840f05c5a80e92e0efd5318982663b6.tar.gz sway-4915f9761840f05c5a80e92e0efd5318982663b6.tar.zst sway-4915f9761840f05c5a80e92e0efd5318982663b6.zip |
Merge pull request #625 from 1ace/fix/buffer-overflow
Fix a couple potential buffer overflows
Diffstat (limited to 'common/ipc-client.c')
-rw-r--r-- | common/ipc-client.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/ipc-client.c b/common/ipc-client.c index 93f2963c..997a87d1 100644 --- a/common/ipc-client.c +++ b/common/ipc-client.c | |||
@@ -32,7 +32,8 @@ int ipc_open_socket(const char *socket_path) { | |||
32 | sway_abort("Unable to open Unix socket"); | 32 | sway_abort("Unable to open Unix socket"); |
33 | } | 33 | } |
34 | addr.sun_family = AF_UNIX; | 34 | addr.sun_family = AF_UNIX; |
35 | strcpy(addr.sun_path, socket_path); | 35 | strncpy(addr.sun_path, socket_path, sizeof(addr.sun_path)); |
36 | addr.sun_path[sizeof(addr.sun_path) - 1] = 0; | ||
36 | int l = sizeof(addr.sun_family) + strlen(addr.sun_path); | 37 | int l = sizeof(addr.sun_family) + strlen(addr.sun_path); |
37 | if (connect(socketfd, (struct sockaddr *)&addr, l) == -1) { | 38 | if (connect(socketfd, (struct sockaddr *)&addr, l) == -1) { |
38 | sway_abort("Unable to connect to %s", socket_path); | 39 | sway_abort("Unable to connect to %s", socket_path); |