Make sure there are at least 2 chars in charset.
This commit is contained in:
parent
d7c89a5f19
commit
46cf8faafd
1 changed files with 2 additions and 2 deletions
|
|
@ -54,8 +54,8 @@ func NewLenChars(length int, chars []byte) string {
|
|||
return ""
|
||||
}
|
||||
clen := len(chars)
|
||||
if clen > 256 {
|
||||
panic("uniuri: maximum length of charset for NewLenChars is 256")
|
||||
if clen < 2 || clen > 256 {
|
||||
panic("uniuri: wrong charset length for NewLenChars")
|
||||
}
|
||||
maxrb := 255 - (256 % clen)
|
||||
b := make([]byte, length)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue