]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
stack: sk_<t1>_new_null() constructor is missing the OPENSSL_sk_set_cmp_thunks()
authorNikola Pajkovsky <nikolap@openssl.org>
Mon, 11 May 2026 13:14:17 +0000 (15:14 +0200)
committerNeil Horman <nhorman@openssl.org>
Wed, 20 May 2026 15:53:32 +0000 (11:53 -0400)
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)

include/openssl/safestack.h.in

index dd20700d7c3c49784b4b493d53f08996a33a7ad0..67e0448252ae5d21b6b2884b084e8c10b006a2a2 100644 (file)
@@ -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)                  \