Skip to content

Commit 1d91773

Browse files
committed
JNI: call ReleaseByteArrayElements() in read/write if native wolfSSL_get_app_data() fails
1 parent 4d556fb commit 1d91773

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

native/com_wolfssl_WolfSSLSession.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,8 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_write
778778
/* get session mutex from SSL app data */
779779
appData = (SSLAppData*)wolfSSL_get_app_data(ssl);
780780
if (appData == NULL) {
781+
(*jenv)->ReleaseByteArrayElements(jenv, raw, (jbyte*)data,
782+
JNI_ABORT);
781783
return WOLFSSL_FAILURE;
782784
}
783785

@@ -864,6 +866,8 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_read(JNIEnv* jenv,
864866
/* get session mutex from SSL app data */
865867
appData = (SSLAppData*)wolfSSL_get_app_data(ssl);
866868
if (appData == NULL) {
869+
(*jenv)->ReleaseByteArrayElements(jenv, raw, (jbyte*)data,
870+
JNI_ABORT);
867871
return WOLFSSL_FAILURE;
868872
}
869873

0 commit comments

Comments
 (0)