lib: Correctly handle encrypted trailer size (fixes #8556) (#8563)

This commit is contained in:
Simon Frei
2023-03-10 14:14:14 +01:00
committed by GitHub
parent b53c1b9a04
commit da72df6ffc
6 changed files with 379 additions and 200 deletions
+1
View File
@@ -1251,6 +1251,7 @@ func (f *sendReceiveFolder) shortcutFile(file protocol.FileInfo, dbUpdateChan ch
}
defer fd.Close()
trailerSize, err := writeEncryptionTrailer(file, fd)
file.EncryptionTrailerSize = int(trailerSize)
if err != nil {
return err
}
+4
View File
@@ -357,6 +357,10 @@ func prepareFileInfoForIndex(f protocol.FileInfo) protocol.FileInfo {
if f.IsReceiveOnlyChanged() {
f.Version = protocol.Vector{}
}
// The trailer with the encrypted fileinfo is device local, don't send info
// about that to remotes
f.Size -= int64(f.EncryptionTrailerSize)
f.EncryptionTrailerSize = 0
// never sent externally
f.LocalFlags = 0
f.VersionHash = nil