summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2003-07-09 20:01:44 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2003-07-09 20:01:44 +0000
commiteced3489cc151bf550e4cc4cdb7b680935f87ff9 (patch)
tree0bc054ec15c79eee07f0337664f872bd9b390c2c /usr.sbin
parent4d8bbf4aef6796dd69ada71cb58bf399f4fb46a6 (diff)
AVoid core dump when package name in package is not valid.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_install/add/perform.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c
index 301dc073445..dcb8994b4f4 100644
--- a/usr.sbin/pkg_install/add/perform.c
+++ b/usr.sbin/pkg_install/add/perform.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: perform.c,v 1.27 2003/07/04 17:31:19 avsm Exp $ */
+/* $OpenBSD: perform.c,v 1.28 2003/07/09 20:01:43 otto Exp $ */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: perform.c,v 1.27 2003/07/04 17:31:19 avsm Exp $";
+static const char rcsid[] = "$OpenBSD: perform.c,v 1.28 2003/07/09 20:01:43 otto Exp $";
#endif
/*
@@ -227,7 +227,11 @@ pkg_do(char *pkg)
setenv(PKG_PREFIX_VNAME, (p = find_plist(&Plist, PLIST_CWD)) ? p->name : ".", 1);
/* Protect against old packages with bogus @name fields */
- PkgName = (p = find_plist(&Plist, PLIST_NAME)) ? p->name : "anonymous";
+ PkgName = (p = find_plist(&Plist, PLIST_NAME)) ? p->name : NULL;
+ if (PkgName == NULL) {
+ pwarnx("package name not set in package file");
+ goto bomb;
+ }
/* See if we're already registered */
(void) snprintf(LogDir, sizeof(LogDir), "%s/%s", dbdir, PkgName);