Commit 0b555646d0 for openssl.org

commit 0b555646d05439a5a3609474dde80a3c410cff76
Author: Nikola Pajkovsky <nikolap@openssl.org>
Date:   Mon May 11 15:14:17 2026 +0200

    stack: sk_<t1>_new_null() constructor is missing the OPENSSL_sk_set_cmp_thunks()

    crypto/bsearch.c:33:17: runtime error: call to function int_compare through pointer to incorrect function type 'int (*)(const void *, const void *)'
    /home/npajkovsky/openssl/openssl/test/stack_test.c:46: note: int_compare defined here

    Fixes: https://github.com/openssl/project/issues/1950
    Signed-off-by: Nikola Pajkovsky <nikolap@openssl.org>

    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Reviewed-by: Neil Horman <nhorman@openssl.org>
    MergeDate: Wed May 20 15:53:41 2026
    (Merged from https://github.com/openssl/openssl/pull/31151)

diff --git a/include/openssl/safestack.h.in b/include/openssl/safestack.h.in
index dd20700d7c..67e0448252 100644
--- a/include/openssl/safestack.h.in
+++ b/include/openssl/safestack.h.in
@@ -120,7 +120,7 @@ extern "C" {
         OPENSSL_sk_freefunc_thunk f_thunk;                                                                                 \
                                                                                                                            \
         f_thunk = (OPENSSL_sk_freefunc_thunk)sk_##t1##_freefunc_thunk;                                                     \
-                                                                                                                           \
+        OPENSSL_sk_set_cmp_thunks(ret, sk_##t1##_cmpfunc_thunk);                                                           \
         return (STACK_OF(t1) *)OPENSSL_sk_set_thunks(ret, f_thunk);                                                        \
     }                                                                                                                      \
     static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n)                  \