summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOlivier Brunel <jjk@jjacky.com>2014-08-09 00:41:35 +0200
committerAllan McRae <allan@archlinux.org>2014-08-09 14:08:41 +1000
commit99a5017f5591d17784ac2456b1401628f2749eea (patch)
tree20ef6604b7c575c2f84d342ab443f8fcdf5b754a /lib
parent17ed9eb7342670a18337516312a25e6cc0b8936c (diff)
downloadpacman-99a5017f5591d17784ac2456b1401628f2749eea.tar.xz
Fix loading invalid package
In 5acfa65f when adding a new variable (hit_mtree), the initialization of a variable (config) was dropped, which could lead to loading invalid package files, i.e. files that aren't archive (no metadata loaded) would return a new alpm_pkg_t with everything set to 0/NULL. Depending on the operation/use of the package, this could lead to segfault. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/be_package.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 22751293..6ec88885 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -540,7 +540,9 @@ error:
alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
const char *pkgfile, int full)
{
- int ret, fd, config, hit_mtree = 0;
+ int ret, fd;
+ int config = 0;
+ int hit_mtree = 0;
struct archive *archive;
struct archive_entry *entry;
alpm_pkg_t *newpkg;