From 26a7ef8ddc2b9dd05d40a3d586acd778375f7cb1 Mon Sep 17 00:00:00 2001 From: ylecollen Date: Mon, 9 Jan 2017 15:12:15 +0100 Subject: Clear some data before releasing them --- .../OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp | 1 + .../OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp | 2 ++ 2 files changed, 3 insertions(+) (limited to 'java/android/OlmLibSdk') diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp index 2e6e4af..a2b1624 100644 --- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp +++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_inbound_group_session.cpp @@ -307,6 +307,7 @@ JNIEXPORT jbyteArray OLM_INBOUND_GROUP_SESSION_FUNC_DEF(decryptMessageJni)(JNIEn if (plainTextMsgPtr) { + memset(plainTextMsgPtr, 0, maxPlainTextLength*sizeof(uint8_t)); free(plainTextMsgPtr); } } diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp index 827e8fd..7330a20 100644 --- a/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp +++ b/java/android/OlmLibSdk/olm-sdk/src/main/jni/olm_outbound_group_session.cpp @@ -129,6 +129,8 @@ JNIEXPORT void OLM_OUTBOUND_GROUP_SESSION_FUNC_DEF(initOutboundGroupSessionJni)( LOGD(" ## initOutboundGroupSessionJni(): success - result=%lu", static_cast(sessionResult)); } + // clear the random buffer + memset(randomBuffPtr, 0, randomLength); free(randomBuffPtr); } } -- cgit v1.2.3