From 46cf8faafd5c0cddba1964cf025f7cb918bfcb4d Mon Sep 17 00:00:00 2001 From: Dmitry Chestnykh Date: Sat, 4 Apr 2015 00:45:19 +0200 Subject: [PATCH] Make sure there are at least 2 chars in charset. --- uniuri.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uniuri.go b/uniuri.go index e256ea5..d4b0d75 100644 --- a/uniuri.go +++ b/uniuri.go @@ -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)