From 99a5017f5591d17784ac2456b1401628f2749eea Mon Sep 17 00:00:00 2001 From: Olivier Brunel Date: Sat, 9 Aug 2014 00:41:35 +0200 Subject: 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 Signed-off-by: Allan McRae --- lib/libalpm/be_package.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3-24-g4f1b