Skip to content

Commit 2047f4d

Browse files
authored
Merge branch 'master' into issue_221_SSLContext_set_ciphers
2 parents 6b4f756 + 4b1ad4a commit 2047f4d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/main/java/org/jruby/ext/openssl/CipherStrings.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,10 @@ static Collection<Def> matchingCiphers(final String cipherString, final String[]
512512
}
513513

514514
int index = 0;
515-
switch ( part.charAt(0) ) {
516-
case '!': case '+': case '-': index++; break;
515+
if (part.length() > 0) {
516+
switch ( part.charAt(0) ) {
517+
case '!': case '+': case '-': index++; break;
518+
}
517519
}
518520

519521
final Collection<Def> matching;

src/test/ruby/ssl/test_context.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,12 @@ def test_set_ciphers_by_array_of_name_version_bits
217217
assert actual.include?("ECDHE-ECDSA-AES128-GCM-SHA256")
218218
end
219219

220+
def test_set_ciphers_empty_array
221+
context = OpenSSL::SSL::SSLContext.new
222+
ex = assert_raise(OpenSSL::SSL::SSLError) do
223+
context.ciphers = []
224+
end
225+
assert_equal "no cipher match", ex.message
226+
end
227+
220228
end

0 commit comments

Comments
 (0)