Fix CRYPTO_get_ex_new_index() to return 1 or higher
authortb <tb@openbsd.org>
Fri, 16 Jun 2023 11:20:01 +0000 (11:20 +0000)
committertb <tb@openbsd.org>
Fri, 16 Jun 2023 11:20:01 +0000 (11:20 +0000)
Mixing SSL_{get,set}_ex_data() and and SSL_{get,set}_app_data() in the
same application causes problems since they both place their data at
the same spot.

From Marc Aldorasi

ok jsing

lib/libcrypto/ex_data.c

index b1e3913..0a9c591 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ex_data.c,v 1.20 2018/03/17 16:20:01 beck Exp $ */
+/* $OpenBSD: ex_data.c,v 1.21 2023/06/16 11:20:01 tb Exp $ */
 
 /*
  * Overhaul notes;
@@ -320,7 +320,7 @@ def_get_class(int class_index)
                gen = malloc(sizeof(EX_CLASS_ITEM));
                if (gen) {
                        gen->class_index = class_index;
-                       gen->meth_num = 0;
+                       gen->meth_num = 1;
                        gen->meth = sk_CRYPTO_EX_DATA_FUNCS_new_null();
                        if (!gen->meth)
                                free(gen);