fix buffered reads

This commit is contained in:
vyzo 2022-01-30 15:11:18 +02:00
parent 72333147d3
commit 4b8369c071
2 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ func readRawCid(buf *bufio.Reader, hbuf []byte) (cid.Cid, error) {
hbuf = hbuf[:int(sz)]
}
if _, err := buf.Read(hbuf); err != nil {
if _, err := io.ReadFull(buf, hbuf); err != nil {
return cid.Undef, xerrors.Errorf("error reading hash: %w", err) // wrap EOF, it's corrupt
}

View File

@ -71,7 +71,7 @@ func (e *MapMarkSetEnv) Recover(name string) (MarkSet, error) {
}
key := make([]byte, int(sz))
if _, err = buf.Read(key); err != nil {
if _, err = io.ReadFull(buf, key); err != nil {
break
}