Do not pass NULL paramenter to bsearch with empty filelist
A filelist can be non-NULL but empty (particularly with a lot of
NoExtract entries). Handle this in alpm_filelist_contains()
Identified using the undefined behaviour sanitizer.
Signed-off-by: Allan McRae <allan@archlinux.org>
(cherry picked from commit 0ccb584262
)
This commit is contained in:
parent
71f522252e
commit
e16b95ddbb
1 changed files with 1 additions and 1 deletions
|
@ -123,7 +123,7 @@ alpm_file_t SYMEXPORT *alpm_filelist_contains(const alpm_filelist_t *filelist,
|
||||||
{
|
{
|
||||||
alpm_file_t key;
|
alpm_file_t key;
|
||||||
|
|
||||||
if(!filelist) {
|
if(!filelist || filelist->count == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue