diff mbox

[03/16] btrfs-progs: use strncpy in btrfs_scan_lblkid()

Message ID 1383779755-18228-4-git-send-email-sandeen@redhat.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Eric Sandeen Nov. 6, 2013, 11:15 p.m. UTC
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>
---
 utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/utils.c b/utils.c
index a7441c1..c11a7c2 100644
--- a/utils.c
+++ b/utils.c
@@ -1952,7 +1952,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;