forked from Mirrors/btrfs-progs
btrfs-progs: use proper size for argv0 substitution
Make run from a long base path will overflow the argv0 buffer during tests. Otherwise, this would happen for all the standalone binaries that use set_argv0. Original report: https://bbs.archlinux.org/viewtopic.php?id=189861 Reported-by: WorMzy Tykashi <wormzy.tykashi@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>master
parent
a1c3bcf1c2
commit
5ebf59ff58
3
utils.c
3
utils.c
|
@ -66,7 +66,8 @@ void fixup_argv0(char **argv, const char *token)
|
|||
|
||||
void set_argv0(char **argv)
|
||||
{
|
||||
sprintf(argv0_buf, "%s", argv[0]);
|
||||
strncpy(argv0_buf, argv[0], sizeof(argv0_buf));
|
||||
argv0_buf[sizeof(argv0_buf) - 1] = 0;
|
||||
}
|
||||
|
||||
int check_argc_exact(int nargs, int expected)
|
||||
|
|
Loading…
Reference in New Issue