Use strlcpy() instead of strcpy() to not overflow static buffers.

This commit is contained in:
Kris Kennaway 2002-10-06 23:52:06 +00:00
parent 5dfca833cf
commit b241e69d12
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104586

View File

@ -107,7 +107,9 @@ main(int ac, char **av)
cflag = 1;
break;
case 'e':
strcpy(execfile, optarg);
if (strlcpy(execfile, optarg, sizeof(execfile))
>= sizeof(execfile))
errx(1, "%s: File name too long", optarg);
eflag = 1;
break;
case 'f':
@ -119,7 +121,9 @@ main(int ac, char **av)
err(1, "%s", optarg);
break;
case 'm':
strcpy(corefile, optarg);
if (strlcpy(corefile, optarg, sizeof(corefile))
>= sizeof(corefile))
errx(1, "%s: File name too long", optarg);
mflag = 1;
break;
case 'o':