diff options
author | joerg <joerg> | 2008-02-22 15:53:52 +0000 |
---|---|---|
committer | joerg <joerg> | 2008-02-22 15:53:52 +0000 |
commit | e118896b9818e7eeeaa6c58df0bc73e2e4534cd5 (patch) | |
tree | c4760e6359e27754051a2cc96112a251f9424374 /pkgtools/pkg_install/files/info | |
parent | 3071f8f04920a98209d8b84c2798c95a99d4e847 (diff) | |
download | pkgsrc-e118896b9818e7eeeaa6c58df0bc73e2e4534cd5.tar.gz |
pkg_install-20080222:
Free libarchive's side of the package before closing the file descriptor.
This stops leaking up to 1MB / package when using bzip2 and addresses
PR 38082. Check that at least +COMMENTS, +CONTENTS and +DESC can be
extracted, otherwise skip the entry. This stops pkg_info -X from dumping
core on non-package files.
Diffstat (limited to 'pkgtools/pkg_install/files/info')
-rw-r--r-- | pkgtools/pkg_install/files/info/perform.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pkgtools/pkg_install/files/info/perform.c b/pkgtools/pkg_install/files/info/perform.c index 63b1aa8bc37..b0ed63ce5cf 100644 --- a/pkgtools/pkg_install/files/info/perform.c +++ b/pkgtools/pkg_install/files/info/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.42 2008/02/05 18:57:09 joerg Exp $ */ +/* $NetBSD: perform.c,v 1.43 2008/02/22 15:53:52 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -17,7 +17,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp"; #else -__RCSID("$NetBSD: perform.c,v 1.42 2008/02/05 18:57:09 joerg Exp $"); +__RCSID("$NetBSD: perform.c,v 1.43 2008/02/22 15:53:52 joerg Exp $"); #endif #endif @@ -234,6 +234,8 @@ read_meta_data_from_fd(int fd) (*target)[size] = '\0'; } + archive_read_finish(archive); + return meta; #endif } @@ -360,6 +362,14 @@ pkg_do(const char *pkg) meta = read_meta_data_from_pkgdb(pkg); } + if (meta->meta_contents == NULL || + meta->meta_comment == NULL || + meta->meta_desc == NULL) { + warnx("invalid package `%s' skipped", pkg); + free_pkg_meta(meta); + return 1; + } + /* * Index is special info type that has to override all others to make * any sense. |