Skip to content

Commit

Permalink
internal/inproc: detect short-buffer during reads
Browse files Browse the repository at this point in the history
  • Loading branch information
sbinet committed Jun 25, 2018
1 parent d10332e commit 7bebbd3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/inproc/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ func (c *conn) read(data []byte) (int, error) {
select {
case bw := <-c.r:
nr := copy(data, bw)
if len(data) < len(bw) {
return nr, io.ErrShortBuffer
}
return nr, nil
case <-c.rdeadline.wait():
return 0, timeoutError{}
Expand Down

0 comments on commit 7bebbd3

Please sign in to comment.