Fix panic when storage value is nil (#5724)
* Fix panic when storage value is nil * Ensure the value is at least of expected length * Format correction * Address review feedback
This commit is contained in:
parent
fa26beeaed
commit
510726494a
|
@ -708,6 +708,11 @@ func (b *AESGCMBarrier) Get(ctx context.Context, key string) (*Entry, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(pe.Value) < 4 {
|
||||||
|
b.l.RUnlock()
|
||||||
|
return nil, errors.New("invalid value")
|
||||||
|
}
|
||||||
|
|
||||||
// Verify the term
|
// Verify the term
|
||||||
term := binary.BigEndian.Uint32(pe.Value[:4])
|
term := binary.BigEndian.Uint32(pe.Value[:4])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue