Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/jruby/org/netssh/bcrypt_pbkdf/BCryptPbkdf.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public final class BCryptPbkdf {
};

static byte[] cryptPbkdf(byte[] pass, byte[] salt, int keylen, int rounds) {
if (rounds < 1 || pass.length == 0 || salt.length == 0 || keylen == 0 || keylen > BCRYPT_HASHSIZE * BCRYPT_HASHSIZE || salt.length > (1 << 20)) {
if (rounds < 1 || pass.length == 0 || salt.length == 0 || keylen < 1 || keylen > BCRYPT_HASHSIZE * BCRYPT_HASHSIZE || salt.length > (1 << 20)) {
return null;
}

Expand Down
1 change: 1 addition & 0 deletions test/bcrypt_pnkdf/engine_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def test_ruby_and_native_returns_the_same
def test_invalid_pbkdf_arguments_return_nil
assert_nil BCryptPbkdf::Engine.__bc_crypt_pbkdf('', 'salt', 14, 1)
assert_nil BCryptPbkdf::Engine.__bc_crypt_pbkdf('pass', '', 14, 1)
assert_nil BCryptPbkdf::Engine.__bc_crypt_pbkdf('pass', 'salt', -1, 1)
assert_nil BCryptPbkdf::Engine.__bc_crypt_pbkdf('pass', 'salt', 0, 1)
assert_nil BCryptPbkdf::Engine.__bc_crypt_pbkdf('pass', 'salt', 14, 0)
assert_nil BCryptPbkdf::Engine.__bc_crypt_pbkdf('pass', 'salt', 1025, 1)
Expand Down