diff options
author | sobomax <sobomax@FreeBSD.org> | 2002-02-20 17:07:19 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2002-02-20 17:07:19 +0000 |
commit | 30b8cebc33186df85f0d5cc72ec1a88c8dcfc820 (patch) | |
tree | 38e432ece50b71faaca775b110fad390298a92ba | |
parent | 139cdbc604834880f98cacebce87a2015962b020 (diff) | |
download | FreeBSD-src-30b8cebc33186df85f0d5cc72ec1a88c8dcfc820.zip FreeBSD-src-30b8cebc33186df85f0d5cc72ec1a88c8dcfc820.tar.gz |
Provide protection against incorrect input (dependency list).
Submitted by: roam
-rw-r--r-- | usr.sbin/pkg_install/create/perform.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c index d2cfd03..2aa7e85 100644 --- a/usr.sbin/pkg_install/create/perform.c +++ b/usr.sbin/pkg_install/create/perform.c @@ -126,11 +126,14 @@ pkg_perform(char **pkgs) errx(2, "%s: alloca() failed", __FUNCTION__); /* Not reached */ } - for (i = 0; Pkgdeps; i++) { + for (i = 0; Pkgdeps;) { cp = strsep(&Pkgdeps, " \t\n"); - if (*cp) + if (*cp) { deps[i] = cp; + i++; + } } + ndeps = i; deps[ndeps] = NULL; sortdeps(deps); |