diff options
author | kris <kris@FreeBSD.org> | 2002-10-06 23:52:06 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2002-10-06 23:52:06 +0000 |
commit | beeea993c6d4c730a94a3de2ab11f1772bd0c3db (patch) | |
tree | 088284bc24c5be1434ac78d0a803e9bd4352d214 /usr.bin | |
parent | 6b78701b611235c18074ae990299062d9ce5de2e (diff) | |
download | FreeBSD-src-beeea993c6d4c730a94a3de2ab11f1772bd0c3db.zip FreeBSD-src-beeea993c6d4c730a94a3de2ab11f1772bd0c3db.tar.gz |
Use strlcpy() instead of strcpy() to not overflow static buffers.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ktrdump/ktrdump.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c index d00ae8c..82b4462 100644 --- a/usr.bin/ktrdump/ktrdump.c +++ b/usr.bin/ktrdump/ktrdump.c @@ -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': |