summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-01-03 03:10:55 +0100
committerDavid Sterba <dsterba@suse.cz>2015-01-03 03:22:19 +0100
commit190e916dfc09efd1c49463d423f1cede6c32a45d (patch)
tree1f64ab270bac7001035df00f18774f3ec239ff15 /utils.c
parentfd1e9ad6a89b9b24a601d85b68c7a616f63ef0a7 (diff)
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 <dsterba@suse.cz>
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c6
1 files changed, 3 insertions, 3 deletions
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)