2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 06:46:34 +00:00

Merge pull request #1056 from restic/fix-1053

prune: Delete invalid/incomplete pack files
This commit is contained in:
Alexander Neumann 2017-06-21 19:25:55 +02:00
commit a03076f2d8

View File

@ -230,11 +230,13 @@ func readHeader(rd io.ReaderAt, size int64) ([]byte, error) {
} }
if int64(hl) > size-int64(binary.Size(hl)) { if int64(hl) > size-int64(binary.Size(hl)) {
return nil, errors.New("header is larger than file") err := InvalidFileError{Message: "header is larger than file"}
return nil, errors.Wrap(err, "readHeader")
} }
if int64(hl) > maxHeaderSize { if int64(hl) > maxHeaderSize {
return nil, errors.New("header is larger than maxHeaderSize") err := InvalidFileError{Message: "header is larger than maxHeaderSize"}
return nil, errors.Wrap(err, "readHeader")
} }
buf := make([]byte, int(hl)) buf := make([]byte, int(hl))