Skip to content

Commit 7855ef1

Browse files
committed
Lazy init stringClass in ssl.c before using to avoid crashes
1 parent 9271644 commit 7855ef1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

native/src/ssl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,12 @@ TCN_IMPLEMENT_CALL(jobjectArray, SSL, getCiphers)(TCN_STDARGS, jlong ssl)
11001100
return NULL;
11011101
}
11021102

1103+
/* Ensure stringClass is initialized (lazy initialization) */
1104+
if (stringClass == NULL) {
1105+
jclass sClazz = (*e)->FindClass(e, "java/lang/String");
1106+
stringClass = (jclass) (*e)->NewGlobalRef(e, sClazz);
1107+
}
1108+
11031109
/* Create the byte[][] array that holds all the certs */
11041110
array = (*e)->NewObjectArray(e, len, stringClass, NULL);
11051111

0 commit comments

Comments
 (0)