#3546: Add string length checks to isValidName

This commit is contained in:
Outfluencer 2023-10-28 04:11:55 +02:00 committed by GitHub
parent f903c54d55
commit e442c3da5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,11 @@ public final class AllowedCharacters
public static boolean isValidName(String name, boolean onlineMode) public static boolean isValidName(String name, boolean onlineMode)
{ {
if ( name.isEmpty() || name.length() > 16 )
{
return false;
}
for ( int index = 0, len = name.length(); index < len; index++ ) for ( int index = 0, len = name.length(); index < len; index++ )
{ {
if ( !isNameAllowedCharacter( name.charAt( index ), onlineMode ) ) if ( !isNameAllowedCharacter( name.charAt( index ), onlineMode ) )