Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2015-07-16 19:05:31 -0400
committerAllan McRae <allan@archlinux.org>2015-08-08 10:39:15 +1000
commit1ee2032b7f4a7aa6de973d7671fc6af135cef9b5 (patch)
treef5bbe645ca897c78d1302ddc0b6abfceabe118a2 /lib/libalpm/handle.c
parent2d0e2bf2558698db242fbc382675ee00044c0d76 (diff)
check dep versions before calling strcmp
Fixes a segfault when trying to remove an assumeinstalled option without a version. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 5c665dbb..94452b00 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -613,10 +613,21 @@ static int assumeinstalled_cmp(const void *d1, const void *d2)
const alpm_depend_t *dep1 = d1;
const alpm_depend_t *dep2 = d2;
- if(strcmp(dep1->name, dep2->name) == 0 && strcmp(dep1->version, dep2->version) == 0) {
+ if(dep1->name_hash != dep2->name_hash
+ || strcmp(dep1->name, dep2->name) != 0) {
+ return -1;
+ }
+
+ if(dep1->version && dep2->version
+ && strcmp(dep1->version, dep2->version) == 0) {
return 0;
}
+ if(dep1->version == NULL && dep2->version == NULL) {
+ return 0;
+ }
+
+
return -1;
}