From 9623d5549e6abee2f21cd45cd5abca4e15d7a570 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Sat, 3 Jan 2015 03:24:10 +0100 Subject: [PATCH] btrfs-progs: safely copy path in btrfs_scan_lblkid We should terminate the string, let's use the wrapper. Resolves-coverity-id: 1127097 Signed-off-by: David Sterba --- utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.c b/utils.c index c066670b..effacd10 100644 --- a/utils.c +++ b/utils.c @@ -2343,7 +2343,7 @@ int btrfs_scan_lblkid() if (!dev) continue; /* if we are here its definitely a btrfs disk*/ - strncpy(path, blkid_dev_devname(dev), PATH_MAX); + strncpy_null(path, blkid_dev_devname(dev)); fd = open(path, O_RDONLY); if (fd < 0) {