aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plumbing/format/idxfile/decoder.go8
-rw-r--r--utils/binary/read.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/plumbing/format/idxfile/decoder.go b/plumbing/format/idxfile/decoder.go
index 020c997..c1269a1 100644
--- a/plumbing/format/idxfile/decoder.go
+++ b/plumbing/format/idxfile/decoder.go
@@ -57,7 +57,7 @@ func (d *Decoder) Decode(idx *Idxfile) error {
func validateHeader(r io.Reader) error {
var h = make([]byte, 4)
- if _, err := r.Read(h); err != nil {
+ if _, err := io.ReadFull(r, h); err != nil {
return err
}
@@ -99,7 +99,7 @@ func readObjectNames(idx *Idxfile, r io.Reader) error {
c := int(idx.ObjectCount)
for i := 0; i < c; i++ {
var ref plumbing.Hash
- if _, err := r.Read(ref[:]); err != nil {
+ if _, err := io.ReadFull(r, ref[:]); err != nil {
return err
}
@@ -135,11 +135,11 @@ func readOffsets(idx *Idxfile, r io.Reader) error {
}
func readChecksums(idx *Idxfile, r io.Reader) error {
- if _, err := r.Read(idx.PackfileChecksum[:]); err != nil {
+ if _, err := io.ReadFull(r, idx.PackfileChecksum[:]); err != nil {
return err
}
- if _, err := r.Read(idx.IdxChecksum[:]); err != nil {
+ if _, err := io.ReadFull(r, idx.IdxChecksum[:]); err != nil {
return err
}
diff --git a/utils/binary/read.go b/utils/binary/read.go
index 608583b..7cd6184 100644
--- a/utils/binary/read.go
+++ b/utils/binary/read.go
@@ -27,7 +27,7 @@ func ReadUntil(r io.Reader, delim byte) ([]byte, error) {
var buf [1]byte
value := make([]byte, 0, 16)
for {
- if _, err := r.Read(buf[:]); err != nil {
+ if _, err := io.ReadFull(r, buf[:]); err != nil {
if err == io.EOF {
return nil, err
}