mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 07:48:50 -05:00
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>
This commit is contained in:
parent
2d0e2bf255
commit
1ee2032b7f
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user