Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/usr.sbin/pkg_install/add Pullup 1.16-1.19 (hubertf):
details: https://anonhg.NetBSD.org/src/rev/019cf0f87b39
branches: netbsd-1-4
changeset: 469258:019cf0f87b39
user: he <he%NetBSD.org@localhost>
date: Sun Aug 22 17:25:06 1999 +0000
description:
Pullup 1.16-1.19 (hubertf):
Treat absolute paths in PLIST properly, i.e. do not allow them
at all.
diffstat:
usr.sbin/pkg_install/add/extract.c | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
diffs (74 lines):
diff -r a57db29abbce -r 019cf0f87b39 usr.sbin/pkg_install/add/extract.c
--- a/usr.sbin/pkg_install/add/extract.c Sun Aug 22 17:22:27 1999 +0000
+++ b/usr.sbin/pkg_install/add/extract.c Sun Aug 22 17:25:06 1999 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: extract.c,v 1.16 1999/03/12 17:32:20 tron Exp $ */
+/* $NetBSD: extract.c,v 1.16.2.1 1999/08/22 17:25:06 he Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
#else
-__RCSID("$NetBSD: extract.c,v 1.16 1999/03/12 17:32:20 tron Exp $");
+__RCSID("$NetBSD: extract.c,v 1.16.2.1 1999/08/22 17:25:06 he Exp $");
#endif
#endif
@@ -69,8 +69,8 @@
dir = home;
for (q = start; q != stop; q = q->next) {
if (q->type == PLIST_FILE) {
- snprintf(try, FILENAME_MAX, "%s/%s", dir, q->name);
- if (make_preserve_name(bup, FILENAME_MAX, name, try) && fexists(bup)) {
+ (void) snprintf(try, sizeof(try), "%s/%s", dir, q->name);
+ if (make_preserve_name(bup, sizeof(bup), name, try) && fexists(bup)) {
(void)chflags(try, 0);
(void)unlink(try);
if (rename(bup, try))
@@ -151,13 +151,13 @@
}
/* first try to rename it into place */
- snprintf(try, FILENAME_MAX, "%s/%s", Directory, p->name);
+ (void) snprintf(try, sizeof(try), "%s/%s", Directory, p->name);
if (fexists(try)) {
(void)chflags(try, 0); /* XXX hack - if truly immutable, rename fails */
if (preserve && PkgName) {
char pf[FILENAME_MAX];
- if (make_preserve_name(pf, FILENAME_MAX, PkgName, try)) {
+ if (make_preserve_name(pf, sizeof(pf), PkgName, try)) {
if (rename(try, pf)) {
warnx(
"unable to back up %s to %s, aborting pkg_add",
@@ -171,17 +171,12 @@
if (rename(p->name, try) == 0) {
/* note in pkgdb */
{
- char *s, t[FILENAME_MAX], *u;
+ char *s, t[FILENAME_MAX];
int rc;
- if (p->name[0] == '/')
- u=p->name;
- else {
- snprintf(t, FILENAME_MAX, "%s/%s", Directory, p->name);
- u=t;
- }
+ (void) snprintf(t, sizeof(t), "%s/%s", Directory, p->name);
- s=pkgdb_retrieve(u);
+ s=pkgdb_retrieve(t);
#ifdef PKGDB_DEBUG
printf("pkgdb_retrieve(\"%s\")=\"%s\"\n", t, s); /* pkgdb-debug - HF */
#endif
@@ -241,7 +236,7 @@
if (p->name[0] == '/')
u=p->name;
else {
- snprintf(t, FILENAME_MAX, "%s/%s", Directory, p->name);
+ (void) snprintf(t, sizeof(t), "%s/%s", Directory, p->name);
u=t;
}
Home |
Main Index |
Thread Index |
Old Index