mirror of https://github.com/ledisdb/ledisdb.git
permit 0 length key, field and member
This commit is contained in:
parent
81a5587c99
commit
581a492f78
|
@ -20,9 +20,9 @@ const (
|
|||
)
|
||||
|
||||
func checkHashKFSize(key []byte, field []byte) error {
|
||||
if len(key) > MaxKeySize {
|
||||
if len(key) > MaxKeySize || len(key) == 0 {
|
||||
return ErrKeySize
|
||||
} else if len(field) > MaxHashFieldSize {
|
||||
} else if len(field) > MaxHashFieldSize || len(field) == 0 {
|
||||
return ErrHashFieldSize
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -13,7 +13,7 @@ type KVPair struct {
|
|||
var errKVKey = errors.New("invalid encode kv key")
|
||||
|
||||
func checkKeySize(key []byte) error {
|
||||
if len(key) > MaxKeySize {
|
||||
if len(key) > MaxKeySize || len(key) == 0 {
|
||||
return ErrKeySize
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -32,9 +32,9 @@ const (
|
|||
)
|
||||
|
||||
func checkZSetKMSize(key []byte, member []byte) error {
|
||||
if len(key) > MaxKeySize {
|
||||
if len(key) > MaxKeySize || len(key) == 0 {
|
||||
return ErrKeySize
|
||||
} else if len(member) > MaxZSetMemberSize {
|
||||
} else if len(member) > MaxZSetMemberSize || len(member) == 0 {
|
||||
return ErrZSetMemberSize
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue