fix: LINEAR search doesn't work properly (if CHARSET_EBCDIC is defined)
authorPavel Stetsuk <pstetsuk@gmail.com>
Thu, 14 Sep 2023 20:05:49 +0000 (23:05 +0300)
committerTomas Mraz <tomas@openssl.org>
Wed, 18 Oct 2023 14:40:09 +0000 (16:40 +0200)
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)

(cherry picked from commit a47fc4ed401da4e2d84e035cc4add566e85b03d0)

crypto/objects/obj_dat.c

index 341f0b20c73e7560a5f855fbc5bd1acb78d3f530..882a9455f855fc588171ed45adb31ddbd7ef6737 100644 (file)
@@ -687,13 +687,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