Use strlcpy() instead of strcpy() to not overflow static buffers.
This commit is contained in:
parent
5dfca833cf
commit
b241e69d12
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104586
@ -107,7 +107,9 @@ main(int ac, char **av)
|
|||||||
cflag = 1;
|
cflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
strcpy(execfile, optarg);
|
if (strlcpy(execfile, optarg, sizeof(execfile))
|
||||||
|
>= sizeof(execfile))
|
||||||
|
errx(1, "%s: File name too long", optarg);
|
||||||
eflag = 1;
|
eflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
@ -119,7 +121,9 @@ main(int ac, char **av)
|
|||||||
err(1, "%s", optarg);
|
err(1, "%s", optarg);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
strcpy(corefile, optarg);
|
if (strlcpy(corefile, optarg, sizeof(corefile))
|
||||||
|
>= sizeof(corefile))
|
||||||
|
errx(1, "%s: File name too long", optarg);
|
||||||
mflag = 1;
|
mflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
|
Loading…
Reference in New Issue
Block a user