From 190e916dfc09efd1c49463d423f1cede6c32a45d Mon Sep 17 00:00:00 2001 From: David Sterba Date: Sat, 3 Jan 2015 03:10:55 +0100 Subject: btrfs-progs: use strncpy in is_same_blk_file Although we're getting strings from the caller, let's be safe. Resolves-coverity-id: 1199475 Signed-off-by: David Sterba --- utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'utils.c') diff --git a/utils.c b/utils.c index af0a8fe5..531bc82a 100644 --- a/utils.c +++ b/utils.c @@ -1005,11 +1005,11 @@ static int is_same_blk_file(const char* a, const char* b) char real_a[PATH_MAX]; char real_b[PATH_MAX]; - if(!realpath(a, real_a)) - strcpy(real_a, a); + if (!realpath(a, real_a)) + strncpy_null(real_a, a); if (!realpath(b, real_b)) - strcpy(real_b, b); + strncpy_null(real_b, b); /* Identical path? */ if(strcmp(real_a, real_b) == 0) -- cgit v1.2.3