aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install/add
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2001-07-28 01:59:58 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2001-07-28 01:59:58 +0000
commit2bae1ab6a53b8b653639d2be8eb2114ce8532c5a (patch)
treee285c427e0c986a4eb2f4f00c2c37eb2e4f426cb /usr.sbin/pkg_install/add
parent0a75b55602c7243159a21a4ed4f98628cce2f009 (diff)
Notes
Diffstat (limited to 'usr.sbin/pkg_install/add')
-rw-r--r--usr.sbin/pkg_install/add/main.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index 2844bf9a0b06c..1c5e4f5a2738b 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -111,7 +111,7 @@ main(int argc, char **argv)
break;
case 't':
- if (s_strlcpy(FirstPen, optarg, sizeof(FirstPen)))
+ if (strlcpy(FirstPen, optarg, sizeof(FirstPen)) > sizeof(FirstPen))
errx(1, "-t Argument too long.");
break;
@@ -145,27 +145,27 @@ main(int argc, char **argv)
if (Remote) {
if ((packagesite = getpackagesite()) == NULL)
errx(1, "package name too long");
- if (s_strlcpy(temppackageroot, packagesite,
- sizeof(temppackageroot)))
+ if (strlcpy(temppackageroot, packagesite,
+ sizeof(temppackageroot)) >= sizeof(temppackageroot))
errx(1, "package name too long");
- if (s_strlcat(temppackageroot, *argv,
- sizeof(temppackageroot)))
+ if (strlcat(temppackageroot, *argv,
+ sizeof(temppackageroot)) >= sizeof(temppackageroot))
errx(1, "package name too long");
remotepkg = temppackageroot;
if (!((ptr = strrchr(remotepkg, '.')) && ptr[1] == 't' &&
ptr[2] == 'g' && ptr[3] == 'z' && !ptr[4]))
- if (s_strlcat(remotepkg, ".tgz", sizeof(temppackageroot)))
+ if (strlcat(remotepkg, ".tgz", sizeof(temppackageroot)) >= sizeof(temppackageroot))
errx(1, "package name too long");
}
if (!strcmp(*argv, "-")) /* stdin? */
pkgs[ch] = "-";
else if (isURL(*argv)) { /* preserve URLs */
- if (s_strlcpy(pkgnames[ch], *argv, sizeof(pkgnames[ch])))
+ if (strlcpy(pkgnames[ch], *argv, sizeof(pkgnames[ch])) >= sizeof(pkgnames[ch]))
errx(1, "package name too long");
pkgs[ch] = pkgnames[ch];
}
else if ((Remote) && isURL(remotepkg)) {
- if (s_strlcpy(pkgnames[ch], remotepkg, sizeof(pkgnames[ch])))
+ if (strlcpy(pkgnames[ch], remotepkg, sizeof(pkgnames[ch])) >= sizeof(pkgnames[ch]))
errx(1, "package name too long");
pkgs[ch] = pkgnames[ch];
} else { /* expand all pathnames to fullnames */
@@ -174,11 +174,11 @@ main(int argc, char **argv)
else { /* look for the file in the expected places */
if (!(cp = fileFindByPath(NULL, *argv))) {
/* let pkg_do() fail later, so that error is reported */
- if (s_strlcpy(pkgnames[ch], *argv, sizeof(pkgnames[ch])))
+ if (strlcpy(pkgnames[ch], *argv, sizeof(pkgnames[ch])) >= sizeof(pkgnames[ch]))
errx(1, "package name too long");
pkgs[ch] = pkgnames[ch];
} else {
- if (s_strlcpy(pkgnames[ch], cp, sizeof(pkgnames[ch])))
+ if (strlcpy(pkgnames[ch], cp, sizeof(pkgnames[ch])) >= sizeof(pkgnames[ch]))
errx(1, "package name too long");
pkgs[ch] = pkgnames[ch];
}
@@ -220,37 +220,37 @@ getpackagesite(void)
struct utsname u;
if (getenv("PACKAGESITE")) {
- if (s_strlcpy(sitepath, getenv("PACKAGESITE"),
- sizeof(sitepath)))
+ if (strlcpy(sitepath, getenv("PACKAGESITE"),
+ sizeof(sitepath)) >= sizeof(sitepath))
return NULL;
return sitepath;
}
if (getenv("PACKAGEROOT")) {
- if (s_strlcpy(sitepath, getenv("PACKAGEROOT"), sizeof(sitepath)))
+ if (strlcpy(sitepath, getenv("PACKAGEROOT"), sizeof(sitepath)) >= sizeof(sitepath))
return NULL;
} else {
- if (s_strlcat(sitepath, "ftp://ftp.freebsd.org", sizeof(sitepath)))
+ if (strlcat(sitepath, "ftp://ftp.freebsd.org", sizeof(sitepath)) >= sizeof(sitepath))
return NULL;
}
- if (s_strlcat(sitepath, "/pub/FreeBSD/ports/", sizeof(sitepath)))
+ if (strlcat(sitepath, "/pub/FreeBSD/ports/", sizeof(sitepath)) >= sizeof(sitepath))
return NULL;
uname(&u);
- if (s_strlcat(sitepath, u.machine, sizeof(sitepath)))
+ if (strlcat(sitepath, u.machine, sizeof(sitepath)) >= sizeof(sitepath))
return NULL;
reldate = getosreldate();
for(i = 0; releases[i].directory != NULL; i++) {
if (reldate >= releases[i].lowver && reldate <= releases[i].hiver) {
- if (s_strlcat(sitepath, releases[i].directory, sizeof(sitepath)))
+ if (strlcat(sitepath, releases[i].directory, sizeof(sitepath)) >= sizeof(sitepath))
return NULL;
break;
}
}
- if (s_strlcat(sitepath, "/Latest/", sizeof(sitepath)))
+ if (strlcat(sitepath, "/Latest/", sizeof(sitepath)) >= sizeof(sitepath))
return NULL;
return sitepath;