From 830d55ba7510e94e37a95a7dffc6dc6357a33333 Mon Sep 17 00:00:00 2001 From: Coty Sutherland Date: Wed, 17 Dec 2025 21:03:09 -0500 Subject: [PATCH] Lazy init stringClass in ssl.c before using to avoid crashes --- native/src/ssl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/native/src/ssl.c b/native/src/ssl.c index 19610d245..99769bb57 100644 --- a/native/src/ssl.c +++ b/native/src/ssl.c @@ -1100,6 +1100,12 @@ TCN_IMPLEMENT_CALL(jobjectArray, SSL, getCiphers)(TCN_STDARGS, jlong ssl) return NULL; } + /* Ensure stringClass is initialized (lazy initialization) */ + if (stringClass == NULL) { + jclass sClazz = (*e)->FindClass(e, "java/lang/String"); + stringClass = (jclass) (*e)->NewGlobalRef(e, sClazz); + } + /* Create the byte[][] array that holds all the certs */ array = (*e)->NewObjectArray(e, len, stringClass, NULL);