From 8a91c64edf551c3c05483ec3f5c87e8dc27a3cc5 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 31 Jul 2020 23:51:23 -0400 Subject: Use snprintf instead of strlcpy --- local.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'local.c') 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); } -- cgit 1.4.1