aboutsummaryrefslogtreecommitdiff
path: root/android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2018-10-17 15:50:36 -0400
committerHubert Chathi <hubert@uhoreg.ca>2018-10-19 12:10:11 -0400
commit1c7ff7f48d121ea1108eec2247a34aaec2906e61 (patch)
treeac222c71797e73e21af4544a5948d1f443a15e81 /android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
parentc4c3055f838092aa5503253363faa55b44d7c0a5 (diff)
more and improved buffer sanitising for Android bindings
Diffstat (limited to 'android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java')
-rw-r--r--android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java b/android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
index b41c67a..2fc81ef 100644
--- a/android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
+++ b/android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
@@ -77,10 +77,16 @@ public class OlmInboundGroupSession extends CommonSerializeUtils implements Seri
Log.e(LOG_TAG, "## initInboundGroupSession(): invalid session key");
throw new OlmException(OlmException.EXCEPTION_CODE_INIT_INBOUND_GROUP_SESSION, "invalid session key");
} else {
+ byte[] sessionBuffer = null;
try {
+ sessionBuffer = aSessionKey.getBytes("UTF-8");
mNativeId = createNewSessionJni(aSessionKey.getBytes("UTF-8"), isImported);
} catch (Exception e) {
throw new OlmException(OlmException.EXCEPTION_CODE_INIT_INBOUND_GROUP_SESSION, e.getMessage());
+ } finally {
+ if (null != sessionBuffer) {
+ Arrays.fill(sessionBuffer, (byte) 0);
+ }
}
}
}
@@ -216,6 +222,7 @@ public class OlmInboundGroupSession extends CommonSerializeUtils implements Seri
if (null != bytesBuffer) {
result = new String(bytesBuffer, "UTF-8");
+ Arrays.fill(bytesBuffer, (byte) 0);
}
} catch (Exception e) {
Log.e(LOG_TAG, "## export() failed " + e.getMessage());