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
3a59030266
commit
89c62e14bd
@ -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