diff options
author | Nick Hudson <nick.hudson@isode.com> | 2013-12-03 17:04:06 (GMT) |
---|---|---|
committer | Nick Hudson <nick.hudson@isode.com> | 2013-12-05 11:10:20 (GMT) |
commit | 2a1c515b337bde1ad4a95888902cd7c9a8ef1aab (patch) | |
tree | 350566fe99fc8dd1f55ce7ff293d3ae8569b7fcc /src/com | |
parent | 82a909b9ff8af20bc5674b3e544dfd81330354d4 (diff) | |
download | stroke-2a1c515b337bde1ad4a95888902cd7c9a8ef1aab.zip stroke-2a1c515b337bde1ad4a95888902cd7c9a8ef1aab.tar.bz2 |
Fix possible ClassCastException when restricting ciphers
Old code was casting Object[] to String[], which may be safe,
but is dependant on the Set's internal implementation of
toArray, and may lead to ClassCastExceptions. We now
preallocate a String[] to avoid the cast and force type
safety for any implementation.
Test-information:
Was crashing when enabling restricted ciphers on Android. Now
works OK.
Change-Id: I759a369449296f1819e91a25aa123b083ec280c9
Signed-off-by: Nick Hudson <nick.hudson@isode.com>
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/isode/stroke/tls/java/JSSEContext.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/isode/stroke/tls/java/JSSEContext.java b/src/com/isode/stroke/tls/java/JSSEContext.java index 77b9447..2928498 100644 --- a/src/com/isode/stroke/tls/java/JSSEContext.java +++ b/src/com/isode/stroke/tls/java/JSSEContext.java @@ -163,7 +163,7 @@ public class JSSEContext extends TLSContext { } String[] suitesToEnable = new String[]{}; if (!matchedSuites.isEmpty()) { - suitesToEnable = (String[])matchedSuites.toArray(); + suitesToEnable = matchedSuites.toArray(new String[matchedSuites.size()]); } sslEngine.setEnabledCipherSuites(suitesToEnable); |