From 45f22b5e8f7aff4da66eb6d4126dddd9ac512c03 Mon Sep 17 00:00:00 2001 From: kris Date: Thu, 19 Jul 2001 06:01:23 +0000 Subject: Correct a reversion in r1.39 which introduced a new instance of strcpy() after r1.38 had attempted to remove them all. --- usr.sbin/pkg_install/add/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'usr.sbin') 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]; -- cgit v1.1