[Reproducible-commits] [dpkg] 10/11: libdpkg: Fix use after free in dpkg_arch_load_list()

Holger Levsen holger at layer-acht.org
Tue May 3 08:43:39 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to annotated tag 1.16.11
in repository dpkg.

commit 07481a877a899b145857886e0ebc5635a523306f
Author: Guillem Jover <guillem at debian.org>
Date:   Thu Aug 8 10:35:50 2013 +0200

    libdpkg: Fix use after free in dpkg_arch_load_list()
    
    Cherry picked from commit 72f4e49f965e8860d541bec7fea814d2cea85c81.
    
    Reported-by: Pedro Ribeiro <pedrib at gmail.com>
---
 debian/changelog | 2 ++
 lib/dpkg/arch.c  | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index f6bae98..cfba5b0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ dpkg (1.16.11) UNRELEASED; urgency=low
   * Only ignore older packages if the existing version is informative. This
     allows any program using libdpkg to parse the available file to see again
     packages with versions lesser than 0-0 (like 0~0-0). Closes: #676664
+  * Fix use after free in dpkg_arch_load_list() on libdpkg.
+    Reported by Pedro Ribeiro <pedrib at gmail.com>.
 
   [ Updated programs translations ]
   * Vietnamese (Trần Ngọc Quân). Closes: #715334
diff --git a/lib/dpkg/arch.c b/lib/dpkg/arch.c
index d8d4312..9ddfd66 100644
--- a/lib/dpkg/arch.c
+++ b/lib/dpkg/arch.c
@@ -275,15 +275,16 @@ dpkg_arch_load_list(void)
 
 	archfile = dpkg_db_get_path(DPKG_DB_ARCH_FILE);
 	fp = fopen(archfile, "r");
-	free(archfile);
 	if (fp == NULL) {
 		arch_list_dirty = true;
+		free(archfile);
 		return;
 	}
 
 	while (fgets_checked(archname, sizeof(archname), fp, archfile) >= 0)
 		dpkg_arch_add(archname);
 
+	free(archfile);
 	fclose(fp);
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list