diff options
| author | Kris Kennaway <kris@FreeBSD.org> | 2001-07-19 06:01:23 +0000 |
|---|---|---|
| committer | Kris Kennaway <kris@FreeBSD.org> | 2001-07-19 06:01:23 +0000 |
| commit | 1da665ef09eff1a47e47a42e202bc47ed0a6faca (patch) | |
| tree | 98035107d92e8b29f919e7013cd244baa2faecf3 | |
| parent | 3ad234d4efc659416d35b44461b74d6886cec9e2 (diff) | |
Notes
| -rw-r--r-- | usr.sbin/pkg_install/add/main.c | 10 |
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 2d63242565b1..b152d3ab1af5 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]; |
