From: Eric Sandeen <sand...@redhat.com>

Use strncpy(... ,PATH_MAX) to be sure we don't overflow
the path[PATH_MAX] array.

Resolves-Coverity-CID: 1125941
Signed-off-by: Eric Sandeen <sand...@redhat.com>
Signed-off-by: Anand Jain <anand.j...@oracle.com>
---
 utils.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils.c b/utils.c
index 753169b..ebd10e5 100644
--- a/utils.c
+++ b/utils.c
@@ -1981,8 +1981,8 @@ int btrfs_scan_lblkid(int update_kernel)
                dev = blkid_verify(cache, dev);
                if (!dev)
                        continue;
-               /* if we are here its definitly a btrfs disk*/
-               strcpy(path, blkid_dev_devname(dev));
+               /* if we are here its definitely a btrfs disk*/
+               strncpy(path, blkid_dev_devname(dev), PATH_MAX);
                if (test_skip_this_disk(path))
                        continue;
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to