Skip to content

Commit

Permalink
Update buf.go
Browse files Browse the repository at this point in the history
  • Loading branch information
odaysec authored Feb 27, 2025
1 parent ba68a24 commit ed4f413
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/pkg/danger/buf.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ func (b *Buf) Reset() {
}

func (b *Buf) grow(n int) {
buf := make([]byte, len(b.buf), 2*cap(b.buf)+n)
newCap := 2*cap(b.buf) + n
if newCap < 0 {
panic("danger.Buf.grow: size computation overflow")
}
buf := make([]byte, len(b.buf), newCap)
copy(buf, b.buf)
b.buf = buf
}
Expand Down

0 comments on commit ed4f413

Please sign in to comment.