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>
master
David Sterba 2015-01-03 03:10:55 +01:00
parent fd1e9ad6a8
commit 190e916dfc
1 changed files with 3 additions and 3 deletions

View File

@ -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)