diff options
author | Karel Zak | 2019-05-20 12:57:16 +0200 |
---|---|---|
committer | Karel Zak | 2019-05-20 12:57:16 +0200 |
commit | e2569bcf2684c6001de5349000bbaccd6f269f8f (patch) | |
tree | 916eca8d9421b28153a8ef2b75c273780623ffc3 /lib | |
parent | lib/sysfs: use xstrncpy() (diff) | |
download | kernel-qcow2-util-linux-e2569bcf2684c6001de5349000bbaccd6f269f8f.tar.gz kernel-qcow2-util-linux-e2569bcf2684c6001de5349000bbaccd6f269f8f.tar.xz kernel-qcow2-util-linux-e2569bcf2684c6001de5349000bbaccd6f269f8f.zip |
lib/path: use xstrncpy()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/path.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; |