Skip to content

Commit

Permalink
fix uint32reader bug that causes ReadMsg to recreate buffer when leng…
Browse files Browse the repository at this point in the history
…ths are the same (#588)
  • Loading branch information
SebiSujar authored and jmarais committed Jul 30, 2019
1 parent 65acae2 commit 0592a1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion io/uint32.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (this *uint32Reader) ReadMsg(msg proto.Message) error {
if length < 0 || length > this.maxSize {
return io.ErrShortBuffer
}
if length >= len(this.buf) {
if length > len(this.buf) {
this.buf = make([]byte, length)
}
_, err := io.ReadFull(this.r, this.buf[:length])
Expand Down

0 comments on commit 0592a1c

Please sign in to comment.