Fix segfault when uninstalling broken backed-up symlink

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@archlinux.org>
This commit is contained in:
Dan McGee 2011-05-16 11:50:13 -05:00
parent 93f02f5793
commit aec60e3782
2 changed files with 1 additions and 3 deletions

View file

@ -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) {

View file

@ -41,5 +41,3 @@ self.addrule("!FILE_EXIST=etc/nonexistent")
self.addrule("FILE_EXIST=etc/exists3")
self.addrule("FILE_TYPE=etc/brokenlink3|link")
self.addrule("FILE_TYPE=etc/exists3|file")
self.expectfailure = True