From: Karel Zak Date: Mon, 20 May 2019 10:57:16 +0000 (+0200) Subject: lib/path: use xstrncpy() X-Git-Tag: v2.34-rc2~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e2569bcf2684c6001de5349000bbaccd6f269f8f;p=thirdparty%2Futil-linux.git lib/path: use xstrncpy() Signed-off-by: Karel Zak --- diff --git a/lib/path.c b/lib/path.c index 05b608e573..f7fd195924 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;