mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
lib/upgrade: Don't attempt processing files larger than expected max binary size (ref #3045)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3047
This commit is contained in:
parent
38166e976f
commit
dd5909568f
@ -224,6 +224,11 @@ func readTarGz(archiveName, dir string, r io.Reader) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if hdr.Size > maxBinarySize {
|
||||
// We don't even want to try processing or skipping over files
|
||||
// that are too large.
|
||||
break
|
||||
}
|
||||
|
||||
err = archiveFileVisitor(dir, &tempName, &sig, hdr.Name, tr)
|
||||
if err != nil {
|
||||
@ -264,6 +269,12 @@ func readZip(archiveName, dir string, r io.Reader) (string, error) {
|
||||
}
|
||||
i++
|
||||
|
||||
if file.UncompressedSize64 > maxBinarySize {
|
||||
// We don't even want to try processing or skipping over files
|
||||
// that are too large.
|
||||
break
|
||||
}
|
||||
|
||||
inFile, err := file.Open()
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
Loading…
Reference in New Issue
Block a user