From e2569bcf2684c6001de5349000bbaccd6f269f8f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 20 May 2019 12:57:16 +0200 Subject: lib/path: use xstrncpy() Signed-off-by: Karel Zak --- lib/path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/path.c b/lib/path.c index 05b608e57..f7fd19592 100644 --- a/lib/path.c +++ b/lib/path.c @@ -25,6 +25,7 @@ #include "all-io.h" #include "path.h" #include "debug.h" +#include "strutils.h" /* * Debug stuff (based on include/debug.h) @@ -279,8 +280,7 @@ char *ul_path_get_abspath(struct path_cxt *pc, char *buf, size_t bufsz, const ch if (!tmp) return NULL; - strncpy(buf, tmp, bufsz); - buf[bufsz - 1] = '\0'; + xstrncpy(buf, tmp, bufsz); } return buf; -- cgit v1.2.3-55-g7522