mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-17 02:06:51 +00:00
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>
This commit is contained in:
parent
fd1e9ad6a8
commit
190e916dfc
6
utils.c
6
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)
|
||||
|
Loading…
Reference in New Issue
Block a user