diff options
author | June McEnroe <june@causal.agency> | 2020-07-31 23:51:23 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-31 23:51:23 -0400 |
commit | 8a91c64edf551c3c05483ec3f5c87e8dc27a3cc5 (patch) | |
tree | cee269932d1d455b2086db9016bae51a196e3867 /local.c | |
parent | Use RAND_bytes instead of arc4random_buf (diff) | |
download | pounce-8a91c64edf551c3c05483ec3f5c87e8dc27a3cc5.tar.gz pounce-8a91c64edf551c3c05483ec3f5c87e8dc27a3cc5.zip |
Use snprintf instead of strlcpy
Diffstat (limited to '')
-rw-r--r-- | local.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/local.c b/local.c index 1e19ae5..b3670ee 100644 --- a/local.c +++ b/local.c @@ -161,8 +161,10 @@ size_t localUnix(int fds[], size_t cap, const char *path) { if (sock < 0) err(EX_OSERR, "socket"); struct sockaddr_un addr = { .sun_family = AF_UNIX }; - size_t len = strlcpy(addr.sun_path, path, sizeof(addr.sun_path)); - if (len >= sizeof(addr.sun_path)) { + int len = snprintf( + addr.sun_path, sizeof(addr.sun_path), "%s", path + ); + if ((size_t)len >= sizeof(addr.sun_path)) { errx(EX_CONFIG, "path too long: %s", path); } |