diff options
-rw-r--r-- | formats/pktline/decoder.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/formats/pktline/decoder.go b/formats/pktline/decoder.go index a078475..c30be6b 100644 --- a/formats/pktline/decoder.go +++ b/formats/pktline/decoder.go @@ -48,10 +48,12 @@ func (d *Decoder) readLine() (string, error) { } line := make([]byte, exp) - if read, err := d.r.Read(line); err != nil { + if read, err := io.ReadFull(d.r, line); err != nil { + if err == io.ErrUnexpectedEOF && read < exp { + return "", ErrUnderflow + } + return "", err - } else if read != exp { - return "", ErrUnderflow } return string(line), nil |