Avoid overflowing `fname' if the file name prefix given on the command
line is too long. Obtained from: OpenBSD
This commit is contained in:
parent
a32a4e42ac
commit
a62d4b84fd
@ -147,7 +147,8 @@ main(argc, argv)
|
||||
++argv;
|
||||
}
|
||||
if (*argv != NULL) /* File name prefix. */
|
||||
(void)strcpy(fname, *argv++);
|
||||
if (strlcpy(fname, *argv++, sizeof(fname)) >= sizeof(fname))
|
||||
errx(EX_USAGE, "file name prefix is too long");
|
||||
if (*argv != NULL)
|
||||
usage();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user