diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-01-28 21:49:12 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-01-28 21:49:12 +0100 |
commit | 45827d8a189724c04d11b128624742fdb3a6679b (patch) | |
tree | 1d6b13d017ce7eda5e0fc0cba90c431dd4a0661c /src/status.c | |
parent | ad29f57f828f72032403c37cd69f5302e99790ec (diff) | |
download | fastd-45827d8a189724c04d11b128624742fdb3a6679b.tar fastd-45827d8a189724c04d11b128624742fdb3a6679b.zip |
Remove a few more instances of strcpy
Diffstat (limited to 'src/status.c')
-rw-r--r-- | src/status.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/status.c b/src/status.c index 3c82e0c..d0b8511 100644 --- a/src/status.c +++ b/src/status.c @@ -220,14 +220,15 @@ void fastd_status_init(void) { exit_errno("fastd_status_init: socket"); - size_t len = offsetof(struct sockaddr_un, sun_path) + strlen(conf.status_socket) + 1; + size_t status_socket_len = strlen(conf.status_socket); + size_t len = offsetof(struct sockaddr_un, sun_path) + status_socket_len + 1; uint8_t buf[len]; memset(buf, 0, len); struct sockaddr_un *sa = (void*)buf; sa->sun_family = AF_UNIX; - strcpy(sa->sun_path, conf.status_socket); + memcpy(sa->sun_path, conf.status_socket, status_socket_len+1); if (bind(ctx.status_fd, (struct sockaddr*)sa, len)) { switch (errno) { |