chunked: validate number of chunks received
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
10d3891c2b
commit
90fd24cd05
|
|
@ -918,6 +918,9 @@ func (c *chunkedDiffer) storeMissingFiles(streams chan io.ReadCloser, errs chan
|
|||
case p := <-streams:
|
||||
part = p
|
||||
case err := <-errs:
|
||||
if err == nil {
|
||||
return errors.New("not enough data returned from the server")
|
||||
}
|
||||
return err
|
||||
}
|
||||
if part == nil {
|
||||
|
|
@ -1575,6 +1578,8 @@ func (c *chunkedDiffer) ApplyDiff(dest string, options *archive.TarOptions) (gra
|
|||
wg.Wait()
|
||||
|
||||
for _, res := range copyResults[:filesToWaitFor] {
|
||||
r := &mergedEntries[res.index]
|
||||
|
||||
if res.err != nil {
|
||||
return output, res.err
|
||||
}
|
||||
|
|
@ -1584,8 +1589,6 @@ func (c *chunkedDiffer) ApplyDiff(dest string, options *archive.TarOptions) (gra
|
|||
continue
|
||||
}
|
||||
|
||||
r := &mergedEntries[res.index]
|
||||
|
||||
missingPartsSize += r.Size
|
||||
|
||||
remainingSize := r.Size
|
||||
|
|
|
|||
Loading…
Reference in New Issue