Skip to content

BufferOverflowException in PasswordGenerator when given rules enforce a longer password than the requests length #129

@tombueng

Description

@tombueng

When the given rules need more chars than requested a BufferOverflowException occurs.

new PasswordGenerator().generatePassword(5,new CharacterRule(EnglishCharacterData.LowerCase,10));

java.nio.BufferOverflowException
	at java.base/java.nio.Buffer.nextPutIndex(Buffer.java:714)
	at java.base/java.nio.HeapCharBuffer.put(HeapCharBuffer.java:212)
	at java.base/java.nio.CharBuffer.append(CharBuffer.java:1800)
	at java.base/java.nio.CharBuffer.append(CharBuffer.java:266)
	at org.passay.PasswordGenerator.fillRandomCharacters(PasswordGenerator.java:100)
	at org.passay.PasswordGenerator.generatePassword(PasswordGenerator.java:77)
	at org.passay.PasswordGenerator.generatePassword(PasswordGenerator.java:53)

I think the expected result should be a password that fits the given rules even if it will be longer than requested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions