btrfs-progs: use strncpy in btrfs_scan_lblkid()

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 <sandeen@redhat.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
Eric Sandeen 2013-11-06 17:15:42 -06:00 committed by Chris Mason
parent 667c121184
commit 6e6e886809

View File

@ -1975,7 +1975,7 @@ int btrfs_scan_lblkid(int update_kernel)
if (!dev)
continue;
/* if we are here its definitly a btrfs disk*/
strcpy(path, blkid_dev_devname(dev));
strncpy(path, blkid_dev_devname(dev), PATH_MAX);
if (test_skip_this_disk(path))
continue;