[pacman-dev] [PATCH 3/3] Fix segfault when uninstalling broken backed-up symlink

Dan McGee dan at archlinux.org
Mon May 16 12:51:46 EDT 2011


Issue FS#24230. If a symlink is broken and included in the removal
process of a package, we blew up and segfaulted due to
alpm_compute_md5sum() returning NULL and then performing a strcmp()
operation.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 lib/libalpm/remove.c            |    2 +-
 test/pacman/tests/symlink002.py |    2 --
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 7c8a99f..22ae2bb 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -266,7 +266,7 @@ static void unlink_file(pmpkg_t *info, char *filename, alpm_list_t *skip_remove,
 				FREE(pkghash);
 			} else {
 				char *filehash = alpm_compute_md5sum(file);
-				int cmp = strcmp(filehash,pkghash);
+				int cmp = filehash ? strcmp(filehash, pkghash) : 0;
 				FREE(filehash);
 				FREE(pkghash);
 				if(cmp != 0) {
diff --git a/test/pacman/tests/symlink002.py b/test/pacman/tests/symlink002.py
index 7dcafb0..6b7423d 100644
--- a/test/pacman/tests/symlink002.py
+++ b/test/pacman/tests/symlink002.py
@@ -41,5 +41,3 @@
 self.addrule("FILE_EXIST=etc/exists3")
 self.addrule("FILE_TYPE=etc/brokenlink3|link")
 self.addrule("FILE_TYPE=etc/exists3|file")
-
-self.expectfailure = True
-- 
1.7.5.1



More information about the pacman-dev mailing list