Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncating an MD5 hash might fail #29

Open
afsmeira opened this issue Feb 23, 2016 · 2 comments
Open

Truncating an MD5 hash might fail #29

afsmeira opened this issue Feb 23, 2016 · 2 comments

Comments

@afsmeira
Copy link

When truncating an MD5 hash to a specific number of chars, it is not validated if the number of chars is larger than the hash itself. Since we are using substring to truncate the hash, this will cause an IndexOutOfBoundsException. See substring documentation.

Reproducing this issue is fairly easy: just configure PDB property maxIdentifierSize to a value larger than 32.

If I have a little spare time I will submit a PR for this.

@rpvilao-gymondo
Copy link

Keep in mind that the thing that needs to be protected is the substring operation itself and not allowing more characters by default since it will fail on some database vendors that do not support more than 30 chars for example.

@defer
Copy link
Collaborator

defer commented Feb 23, 2016

PDB already depends on commons-lang, so using org.apache.commons.lang.StringUtils#substring would solve the exception but wouldn't match the expectation of having a larger maxIdentifierSize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants