fix: LINEAR search doesn't work properly (if CHARSET_EBCDIC is defined)

CLA: trivial

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22108)
This commit is contained in:
Pavel Stetsuk
2023-10-18 16:39:34 +02:00
committed by Tomas Mraz
parent 21b98da9d8
commit a47fc4ed40
+4 -3
View File
@@ -677,13 +677,14 @@ const void *OBJ_bsearch_ex_(const void *key, const void *base, int num,
if (p == NULL) {
const char *base_ = base;
int l, h, i = 0, c = 0;
char *p1;
for (i = 0; i < num; ++i) {
p = &(base_[i * size]);
c = (*cmp) (key, p);
p1 = &(base_[i * size]);
c = (*cmp) (key, p1);
if (c == 0
|| (c < 0 && (flags & OBJ_BSEARCH_VALUE_ON_NOMATCH)))
return p;
return p1;
}
}
#endif