summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2001-07-19 06:01:23 +0000
committerkris <kris@FreeBSD.org>2001-07-19 06:01:23 +0000
commit45f22b5e8f7aff4da66eb6d4126dddd9ac512c03 (patch)
tree98035107d92e8b29f919e7013cd244baa2faecf3 /usr.sbin
parent8e847a512321399ee40f1f1ec78e84d3cd35ee43 (diff)
downloadFreeBSD-src-45f22b5e8f7aff4da66eb6d4126dddd9ac512c03.zip
FreeBSD-src-45f22b5e8f7aff4da66eb6d4126dddd9ac512c03.tar.gz
Correct a reversion in r1.39 which introduced a new instance of strcpy()
after r1.38 had attempted to remove them all.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_install/add/main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index 2d63242..b152d3a 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -172,10 +172,12 @@ main(int argc, char **argv)
if (fexists(*argv)) /* refers to a file directly */
pkgs[ch] = realpath(*argv, pkgnames[ch]);
else { /* look for the file in the expected places */
- if (!(cp = fileFindByPath(NULL, *argv)))
- /* let pkg_do() fail later, so that error is reported */
- pkgs[ch] = strcpy(pkgnames[ch], *argv);
- else {
+ if (!(cp = fileFindByPath(NULL, *argv))) {
+ /* let pkg_do() fail later, so that error is reported */
+ if (s_strlcpy(pkgnames[ch], *argv, sizeof(pkgnames[ch])))
+ errx(1, "package name too long");
+ pkgs[ch] = pkgnames[ch];
+ } else {
if (s_strlcpy(pkgnames[ch], cp, sizeof(pkgnames[ch])))
errx(1, "package name too long");
pkgs[ch] = pkgnames[ch];
OpenPOWER on IntegriCloud