mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-10 15:20:56 +00:00
lib/model: Don't panic if block size in index is larger than protocol block size
This doesn't happen today, but it might in the future if the block size were increased or made variable and we were talking to a client from the future.
This commit is contained in:
parent
1901a5a9f4
commit
e99be02055
@ -1260,7 +1260,11 @@ func (f *sendReceiveFolder) copierRoutine(in <-chan copyBlocksState, pullChan ch
|
||||
continue
|
||||
}
|
||||
|
||||
buf = buf[:int(block.Size)]
|
||||
if s := int(block.Size); s > cap(buf) {
|
||||
buf = make([]byte, s)
|
||||
} else {
|
||||
buf = buf[:s]
|
||||
}
|
||||
|
||||
found, err := weakHashFinder.Iterate(block.WeakHash, buf, func(offset int64) bool {
|
||||
if _, err := verifyBuffer(buf, block); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user