summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-08-15 01:21:46 +0000
committerjoerg <joerg@pkgsrc.org>2007-08-15 01:21:46 +0000
commit8d30fc24919497b584b489243798464836baec93 (patch)
tree3a352d00fec4a96751d2cb667e9eea2694d3e1f2
parentab17300d32b6841d8a212a2360306c4e43947896 (diff)
downloadpkgsrc-8d30fc24919497b584b489243798464836baec93.tar.gz
Bail out if the PLIST contains no @name field. This check existed since
the initial revision in 2002, so assume it just works...
-rw-r--r--pkgtools/pkg_install/files/add/perform.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c
index f1e2f94d975..87a001f2f93 100644
--- a/pkgtools/pkg_install/files/add/perform.c
+++ b/pkgtools/pkg_install/files/add/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.58 2007/08/15 01:16:27 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.59 2007/08/15 01:21:46 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -14,7 +14,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.58 2007/08/15 01:16:27 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.59 2007/08/15 01:21:46 joerg Exp $");
#endif
#endif
@@ -589,7 +589,12 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs)
}
/* Protect against old packages with bogus @name fields */
- PkgName = (p = find_plist(&Plist, PLIST_NAME)) ? p->name : "anonymous";
+ p = find_plist(&Plist, PLIST_NAME);
+ if (p->name == NULL) {
+ warnx("PLIST contains no @name field");
+ goto bomb;
+ }
+ PkgName = p->name;
if (fexists(VIEWS_FNAME))
is_depoted_pkg = TRUE;