mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 15:32:35 +00:00
array: fix search for empty arrays
When the array is empty `cmp` never gets set by the comparison function. Initialize it so we return ENOTFOUND in those cases.
This commit is contained in:
parent
661db4f482
commit
1a2d8bd3c2
@ -96,7 +96,7 @@ GIT_INLINE(int) git_array__search(
|
||||
{
|
||||
size_t lim;
|
||||
unsigned char *part, *array = array_ptr, *base = array_ptr;
|
||||
int cmp;
|
||||
int cmp = -1;
|
||||
|
||||
for (lim = array_len; lim != 0; lim >>= 1) {
|
||||
part = base + (lim >> 1) * item_size;
|
||||
|
Loading…
Reference in New Issue
Block a user