Skip to content

Commit

Permalink
types: fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Jun 6, 2024
1 parent 3c5c687 commit 15a039b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions types/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ func (d *Decoder) ReadUint64() uint64 {
}

// ReadPrefix reads a length prefix from the underlying stream. If the length
// exceeds the number of bytes remaining in the stream, ReadPrefix sets d.Err
// exceeds the maximum number of elements, ReadPrefix sets d.Err
// and returns 0.
func (d *Decoder) ReadPrefix(max int64) int {
func (d *Decoder) ReadPrefix(limit int64) int {
n := d.ReadUint64()
if n > uint64(max) {
d.SetErr(fmt.Errorf("encoded object contains invalid length prefix (%v elems > %v elems)", n, max))
if n > uint64(limit) {
d.SetErr(fmt.Errorf("encoded object contains invalid length prefix (%v elems > %v elems)", n, limit))
return 0
}
return int(n)
Expand Down

0 comments on commit 15a039b

Please sign in to comment.