[pacman-dev] [PATCH] Fix loading invalid package

Olivier Brunel jjk at jjacky.com
Fri Aug 8 18:41:35 EDT 2014


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 at jjacky.com>
---
 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 2275129..6ec8888 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;
-- 
2.0.4


More information about the pacman-dev mailing list