From 74856596876e87b02f4c7034b51c3aea1ec9efbe Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Tue, 13 May 2014 11:57:51 +0200 Subject: [PATCH] libxbps: use strlcpy instead of strncpy --- lib/initend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/initend.c b/lib/initend.c index 2e72314f..b2399ed1 100644 --- a/lib/initend.c +++ b/lib/initend.c @@ -180,7 +180,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested, bool vpkgconf size_t len, nlines = 0; ssize_t read; char *line = NULL; - char ocwd[XBPS_MAXPATH], tmppath[XBPS_MAXPATH]; + char ocwd[XBPS_MAXPATH] = { 0 }, tmppath[XBPS_MAXPATH] = { 0 }; char *cwd; int rv = 0; @@ -195,7 +195,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested, bool vpkgconf } /* cwd to the dir containing the config file */ - strncpy(tmppath, path, sizeof(tmppath)); + strlcpy(tmppath, path, sizeof(tmppath)); cwd = dirname(tmppath); if (getcwd(ocwd, sizeof(ocwd)) == NULL) { rv = errno;